fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int a, b, c;
  6. scanf("%d %d %d", &a, &b, &c);
  7.  
  8. switch(c)
  9. {
  10. case 1:
  11. printf("%d + %d = %d", a, b, (a+b));
  12. break;
  13. case 2:
  14. printf("%d - %d = %d", a, b, (a-b));
  15. break;
  16. case 3:
  17. printf("%d * %d = %d", a, b, (a*b));
  18. break;
  19. case 4:
  20. switch ( a % b )
  21. {
  22. case 0:
  23. printf("%d ÷ %d = %d", a, b, (a / b));
  24. break;
  25. default :
  26. printf("%d ÷ %d = %d 余り %d", a, b, (a / b), (a % b) );
  27. break;
  28. }
  29. }
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 5328KB
stdin
128
16
1
stdout
128 + 16 = 144