下面程序段是从键盘输入的字符中统计数字字符的个数,用换行符结束循环。int n = 0, c;c = getchar();while ( ____________________ ) {if ( ____________________) n++;c = getchar();}
查看答案
下面程序的功能是用do-while语句求1—1000之间满足“用3除余2,用5除余3,用7除余2”的数,且一行只打印5个数。#include main() {int i = 1; j = 0;do {if ( ________________________________________ ) {printf(“%4d”, i);j = j +1;if ( ____________________ ) printf(“\n”);}i = i + 1} while (i < 1000);}
下面程序的功能是打印100以内个位数为6,且能被3整除的所有数。#include main() {int i, j;for (i = 0; ____________________; i++) {j = i * 10 + 6;if ( ____________________ ) continue;printf(“%d”, i);}}
1. 以下程序的运行结果是( )。main() {int m = 5;if (m++ > 5)printf(“%d \n”, m);elseprintf(“%d \n”, m--);}
A. 4
B. 5
C. 6
D. 7
2. x与y的函数关系如下图所示,下面程序段中,能正确表示下面函数关系的是( )。xyx < 0 x – 1x = 0 xx > 0 x + 1
A. y = x + 1; if (x >= 0) if (x == 0) y = x; elsey = x - 1;
B. y = x – 1; if (x != 0)if (x > 0)y = x + 1;elsey = x;
C. if (x <= 0) if (x < 0) y = x – 1;elsey = x; elsey = x + 1;
D. y = x; if (x <= 0)if (x < 0)y = x – 1;elsey = x + 1;