题目内容

下面程序的功能是用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;

3. 以下程序的输出结果是( )。main() {int x = 2, y = -1, z = 2;if (x < y)if (y < 0)z = 0;elsez += 1;printf(“%d \n”, z);

A. 3
B. 2
C. 1
D. 0

答案查题题库