编程题:输入一个整型变量num,判断num是否为偶数,为偶数则输出num值。
查看答案
读程序,写出运行结果。#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,则运行结果为: