fork download
  1. // if.c
  2. #include <stdio.h>
  3.  
  4. int main(void)
  5. {
  6. int a, b, c;
  7. scanf("%d", &a); // <= 10
  8.  
  9. b = a == 0;
  10. c = a == 10;
  11.  
  12. printf("b: %d\n",b); // => b: 0
  13. printf("c: %d\n",c); // => c: 1
  14.  
  15. if (a == 0) {
  16. printf("aは0\n");
  17. } else if (a <= 10) {
  18. printf("aは10以下\n");
  19. } else {
  20. printf("aは11より大きい\n");
  21. }
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5356KB
stdin
10
stdout
b: 0
c: 1
aは10以下