fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a, b;
  5.  
  6. scanf("%d %d", &a, &b);
  7.  
  8. if (b == 0) {
  9. return 0;
  10. }
  11.  
  12. switch (a % b) {
  13. case 0:
  14. printf("%d / %d = %d\n", a, b, a / b);
  15. break;
  16. default:
  17. printf("%d / %d = %d ... %d\n", a, b, a / b, a % b);
  18. break;
  19. }
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 5316KB
stdin
8 2
stdout
8 / 2 = 4