fork download
  1. #include <stdio.h>
  2. //int main()
  3. //{
  4. // int a=10;
  5. // int b=20;
  6. // printf("%d\n",a+b);
  7. // printf("%d\n",a*b);
  8. // printf("%d\n",a/b);//最近一次将一切都该回原始int b=20以及%d后面报出的是0,是因为int是整型10/20为0.5因此它只取前面的0
  9. //前一次运算的时候“int b=20”而不是20.0。改成20.0还是不行。无论我d改为f,还是改回来都不行以及a=10.0我也试过了不行
  10. //int b改为float b也不行,其他都不改变将b改为b.0会报错
  11. // printf("%d\n",b/a);
  12. // printf("%d\n",4+234);
  13. // printf("%d\n",678-345);
  14. // printf("%d\n",34/17);
  15. // printf("%.8f\n",10/3.0);
  16. //这里前一次在%后面输的是“8”而不是".8"导致最后输出的数为3.333333是小数点后6位而不是我设定的后8位。
  17. // return 0;
  18.  
  19. //}
  20.  
  21. //求模运算符% /得商 %得余(仅用于整数间)
  22. //int main()
  23. //{
  24. // printf("%d\n",123%10);// 123/10=12.3 最后输出3
  25. // printf("%d\n",123%100);// 123/100=1.23 最后输出23
  26. // printf("%d\n",1234%100);// 1234//100=12.34 最后输出34
  27. // return 0;
  28. //}
  29.  
  30. //负数求余
  31. int main()
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
Success #stdin #stdout 0s 5328KB
stdin
Standard input is empty
stdout
3
23
34