#include <stdio.h>
main()
{ int a=1;int b=2;int c=2;int t;
while(a<b<c)
{ t= a;a= b; b=t; c–;
}
printf(“%d,%d,%d”,a,b,c);
}
1,2,0
2,1,0
1,2,1
2,1,1
选A
while循环中先执行a<b(1<2)得1,再跟c(=2)进行比较,所以会进入while的循环。利用如下代码打印出中间结果
a < b = 1
t = 1 a = 2 b = 1 c = 1
a < b = 0
t = 2 a = 1 b = 2 c = 0
1,2,0
最终运行结果为1,2,0