题目内容

读程序,写出运行结果。#include main( ){ int a=1,b=0;scanf("%d",&a);switch(a){case 1: b=1;printf("b=%d ,", b);case 2: b=2;printf("b=%d ,", b);case 3: b=3;printf("b=%d ,", b);break;default : b=10;printf("b=%d ,", b); }}若键盘输入2,运运行结果为:_________________

查看答案
更多问题

读程序题:#include main(){ float a,b,c,t; a=3; b=7; c=1;if(a>b) {t=a;a=b;b=t;}if(a>c) {t=a;a=c;c=t;}if(b>c) {t=b;b=c;c=t;}printf("%5.2f,%5.2f,%5.2f",a,b,c);}

#include < stdio .h >void main ( ){ float c=3.0 , d=4.0;if ( c>d ) c=5.0;elseif ( c==d ) c=6.0;else c=7.0;printf ( “%.1f\n”,c ) ;}运行结果为_____________________

#include main(){ int m; scanf("%d", &m); if (m >= 0) { if (m%2 == 0) printf("%d is a positive even\n", m); else printf("%d is a positive odd\n", m); } else { if (m % 2 == 0) printf("%d is a negative even\n", m); else printf("%d is a negative odd\n", m); }}若键入-9,则运行结果为:

编程题:利用switch语句实现,输入一周中的某一天,查询这一天是工作日还是周末休息日。提示:查询某一天是工作日还是休息日,一次执行一条指令,可以用switch语句;

答案查题题库