fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. int shou_int;
  7. double x=5.6, y=0.8, shou, amari;
  8.  
  9. shou = x / y;
  10. shou_int = (int)shou;
  11. amari = fmod(x, y);
  12.  
  13. printf("商の結果は・・・%.15f\n",shou);
  14. printf("商の整数は・・・%d\n",shou_int);
  15. printf("あまりの結果は・・・%.15f\n",amari);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
商の結果は・・・6.999999999999999
商の整数は・・・6
あまりの結果は・・・0.799999999999999