问题 填空题

以下程序在运行时若输入:1234567,则程序的运行结果是______。
#include<stdio.h>
main()
 int x, y;
 scanf("%2d%1d", &x, &y); printf("%d\n", x+y);

答案

参考答案:O

解析: scanf中"%2d"指定了变量x的位数为2位,"%1d",指定了变量y的位数为1位,所以x的值为12,y的值为3,x+y=15。

选择题
单项选择题