以下程序运行后的输出结果是( )。 #include<stdio.h> main() { int x=20;  printf("%d", 0<x<20);  printf("%d\n", 0<x && x<20);

admin2011-06-10  21

问题 以下程序运行后的输出结果是(       )。
   #include<stdio.h>
   main()
   { int x=20;
    printf("%d", 0<x<20);
   printf("%d\n", 0<x && x<20);
   }

选项

答案10

解析 表达式0<x<20,首先计算0<x,其值为1,再计算1<20,其值为1,输出1;表达式0<x && x<20,0<x为1,x<20为0,再计算1 && 0,其值为0,输出0。所以输出结果为10。
转载请注明原文地址:https://kaotiyun.com/show/k3Pp777K
0

最新回复(0)