若程序执行时的输入数据是"2473",则下述程序的输出结果是 #include<stdio.h> void main() { int cs; while((cs=getchar())!=,'\n') {switch(cs='2') { case0 case 1:putchar(cs+4); case 2:putchar(cs+4); break; case 3:putchar(cs+3);default:putchar(cs+2);}}}
A.668977
B.668966
C.6677877
D.6688766
第1题:
以下程序的输出结果是( )。 #include <stdio.h> int fan(int); main() { int w=5; fun(w); printf("\n"); } fun(int k) { if(k>0) fun(k-1); printf("%d",k); }
A.5 4 3 2 1
B.0 1 2 3 4 5
C.1 2 3 4 5
D.5 4 3 2 1 0
第2题:
有以下程序,当输入数据为:12.5时,程序输出结果是()。 #include "stdio.h" main() { int a; scanf("%d",&a); printf("a=%dn",a); }
第3题:
以下程序执行时如果输入Language Programming,则程序输出结果是? #include <stdio.h> main() { char str[30]; scanf("%s",str); printf("%sn",str); }
第4题:
下列程序运行时输入1234567<CR>,则输出结果是______。
include<stdio.h>
main()
{ int a=1,b;
scanf("%2d%2d",&a,&b);printf("%d %d\n", a,b);
}
本题考查的重点是scanf函数的调用。scanf(“格式化字符串>”,地址表>),格式化字符串后可以加上场宽,本题中两个变量的场宽都为2,所以输入1234567CR>后,变量a的值为12。变址b的值为34,从而输出为12 34。
第5题:
【单选题】若程序执行时的输入数据是2473<回车>,则下述程序的输出结果是______。 #include <stdio.h> void main() { int cs; while((cs=getchar())!='n') {switch(cs-'2') { case 0: case 1: putchar(cs+4); case2: putchar(cs+4); break; case 3: putchar(cs+3); default:putchar(cs+2); } } }
A.668977
B.668966
C.6677877
D.6688766