#12919. C语言选择结构填空题
C语言选择结构填空题
题号: 1
类型: 填空题
题目: 阅读以下代码片段,当输入 x
为 10 时,程序会输出 {{ input(1) }}。
int x;
scanf("%d", &x);
if(x > 10) {
printf("大于10");
} else if(x == 10) {
printf("等于10");
} else {
printf("小于10");
}
题号: 2
类型: 填空题
题目: 阅读以下代码片段,当输入 a
为 3 且 b
为 5 时,程序会输出 {{ input(2) }}。
int a, b;
scanf("%d %d", &a, &b);
if(a > b) {
printf("a更大");
} else if(a < b) {
printf("b更大");
} else {
printf("相等");
}
题号: 3
类型: 填空题
题目: 阅读以下代码片段,当输入 num
为 -7 时,程序会输出 {{ input(3) }}。
int num;
scanf("%d", &num);
if(num > 0 && num % 2 == 0) {
printf("正偶数");
} else if(num < 0 && num % 2 != 0) {
printf("负奇数");
} else {
printf("其他情况");
}
题号: 4
类型: 填空题
题目: 阅读以下代码片段,当输入 ch
为 '9' 时,程序会输出 {{ input(4) }}。
char ch;
scanf("%c", &ch);
if(ch >= '0' && ch <= '9') {
printf("数字字符");
} else {
printf("非数字字符");
}
题号: 5
类型: 填空题
题目: 阅读以下代码片段,当输入 score
为 85 且 flag
为 1 时,程序会输出 {{ input(5) }}。
int score, flag;
scanf("%d %d", &score, &flag);
if(score >= 60 && flag == 1) {
printf("通过");
} else if(score >= 60 && flag == 0) {
printf("待定");
} else {
printf("未通过");
}
相关
在以下作业中: