pxxfxxxxx

导航

关于c的比较

 1 #include <stdio.h>
 2 
 3 int main() {
 4     int a = 2, b = 3, c = b % a;// b % a == 1
 5     if (a <= b <= c) {
 6         printf("Yes!\n");
 7 
 8     } else {
 9         printf("No!\n");
10     }
11     return 0;
12 }
13 
14 Yes!
15 
16 Process returned 0 (0x0)   execution time : 0.816 s
17 Press any key to continue.
18 
19 #include <stdio.h>
20 
21 int main() {
22     int a = 2, b = 3, c = b % a;// b % a == 1
23     if (a <= b && b<= c) {
24         printf("Yes!\n");
25 
26     } else {
27         printf("No!\n");
28     }
29     return 0;
30 }
31 
32 No!
33 
34 Process returned 0 (0x0)   execution time : 1.108 s
35 Press any key to continue.
36 
37 // C语言里每次比较只能做一个

 

posted on 2019-05-13 15:28  pxxfxxxxx  阅读(234)  评论(0编辑  收藏  举报