题目内容

若运行以下程序时输入:A<回车>,则程序的运行结果是 。#include int main(){void action1(int,int),action2(int,int);char ch;int a=15,b=23;ch=getchar();switch(ch){case 'a':case 'A': action1(a,b);break;case 'b':case 'B': action2(a,b);break;default: putchar('\a');}return 0;}void action1(int x,int y){printf("x+y=%d\n",x+y);}void action2(int x,int y){printf("x*y=%d\n",x*y);}

查看答案
更多问题

若运行以下程序时输入:2012<回车>,则程序的运行结果是 。#include int main(){int year,leap;scanf("%d",&year);if (year%4==0){if(year%100==0){if(year%400==0)leap=1;elseleap=0;}elseleap=1;}elseleap=0;if (leap)printf("%d is ",year);elseprintf("%d is not ",year);printf("a leap year.\n");return 0;}

若运行以下程序时输入:2100<回车>,则程序的运行结果是 。#include int main(){int year,leap;scanf("%d",&year);if (year%4==0){if(year%100==0){if(year%400==0)leap=1;elseleap=0;}elseleap=1;}elseleap=0;if (leap)printf("%d is ",year);elseprintf("%d is not ",year);printf("a leap year.\n");return 0;}

若运行以下程序时输入:2050<回车>,则程序的运行结果是 。#include int main(){int year,leap;scanf("%d",&year);if(year%4!=0)leap=0;else if (year%100!=0)leap=1;else if(year%400!=0)leap=0;elseleap=1;if (leap)printf("%d is ",year);elseprintf("%d is not ",year);printf("a leap year.\n");return 0;}

若运行以下程序时输入:2021<回车>,则程序的运行结果是 。#include int main(){int year,leap;printf("enter year:");scanf("%d",&year);if((year%4==0 && year%100!=0) || (year%400==0))leap=1;elseleap=0;if (leap)printf("%d is ",year);elseprintf("%d is not ",year);printf("a leap year.\n");return 0;}

答案查题题库