请读程序:#include <stdio. h>main(){ int a; float b, c; scanf ("% 2d% 3%/4f",&a,&b,&c); printf("\na=%d, b=%f, c=%f\n", a, b, c);}

admin2013-06-11  20

问题 请读程序:#include <stdio. h>main(){  int a; float b, c;  scanf ("% 2d% 3%/4f",&a,&b,&c);  printf("\na=%d, b=%f, c=%f\n", a, b, c);}   若运行时从键盘上输入9876543210,则上面程序的输出结果是______。

选项 A、a=9b=765, c=4321
B、a=10,b=432,c=8765
C、a=98,b=765.000000,c=4321.000000
D、a=98,b=765.0,c=4321.0

答案4

解析 scanf()用户从键盘录入助数字的第1、2位存入整型变量a;把第3、4、5位存入单精度实型变量b,把第6、7、 8、9位存入单精度实型变量c,用户录入的第10位被scanf()遗弃。这时变量a、b、c的值分别为:98、765.000000、 4321.000000.
转载请注明原文地址:https://jikaoti.com/ti/WAn0FFFM
0

最新回复(0)