fork download
  1. int main()
  2. {
  3. int x = 3;
  4. int y = 5;
  5.  
  6. // if文
  7. if (x < y) {
  8. write("x is less than y\n");
  9. }
  10. else if (x > y) {
  11. write("x is greater than y\n");
  12. }
  13. else {
  14. write("x and y are equal\n");
  15. }
  16.  
  17. // switch文
  18. switch (x) {
  19. case 1:
  20. write("x is 1\n");
  21. break;
  22. case 2:
  23. write("x is 2\n");
  24. break;
  25. case 3:
  26. write("x is 3\n");
  27. break;
  28. default:
  29. write("x is not 1, 2, or 3\n");
  30. break;
  31. }
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0.03s 6580KB
stdin
Standard input is empty
stdout
x is less than y
x is 3