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