include <;stdio.h>;void main(){int x = 1, y = 10;do{y -= x;x++;}while ( y <; 0 );printf( “\nx=%d, y=%d”, x, y );}结果为:
A: x=2,y=9
B: 2,9
C: x=1,y=9
D: x=1,y=10
A: x=2,y=9
B: 2,9
C: x=1,y=9
D: x=1,y=10
举一反三
- 如下程序的输出是什么? #include [stdio.h] void Swap (int x, int y); int main() { int x = 1; int y = 2; printf ("x=%d,y=%d\n", x, y); Swap (x, y); printf ("x=%d,y=%d", x, y); } void Swap (int x, int y) { int temp; temp = x; x = y; y = temp; printf ("x=%d,y=%d\n", x, y); } A: x=1,y=2x=2,y=1x=2,y=1 B: x=1,y=2x=1,y=2x=2,y=1 C: x=1,y=2x=2,y=1x=1,y=2 D: x=1,y=2x=1,y=2x=1,y=2
- 如下程序的输出是什么? #include <stdio.h> void Swap (int x, int y);int main() { int x = 1; int y = 2; printf ("x=%d,y=%d\n", x, y); Swap (x, y); printf ("x=%d,y=%d", x, y); } void Swap (int x, int y) { int temp; temp = x; x = y; y = temp; printf ("x=%d,y=%d\n", x, y); }? x=1,y=2x=2,y=1x=2,y=1|x=1,y=2x=1,y=2x=2,y=1|x=1,y=2x=2,y=1x=1,y=2|x=1,y=2x=1,y=2x=1,y=2
- 阅读下列程序,写出运行结果 。#include <;stdio.h>;main ( ){ int x=1, y=10;if(x!=2) y=y+2;else y=y*2;printf("%d", y);}
- 假定x和y为int型变量,则执行以下语句后y的输出值为( )x=-1;y=10;do{ y-=x;x++;}while(x);printf(“%d”, y); A: 9 B: -2 C: -1 D: 11
- 以下程序的输出结果是( )。main(){ int x=1,y=2; void swap(int x,int y); swap(x,y); printf("x=%d,y=%d\n",x,y);}void swap(int x,int y){ x=3,y=4;} A: x=3,y=4 B: x=1,y=2 C: x=3 y=4 D: x=1 y=2