fork download
  1. #include <stdio.h>
  2. float func(int x){
  3. return (x - 32.0) * (5.0 / 9.0);
  4. }
  5.  
  6. float func_ex_cast(int x){
  7. return ((float)x - 32.0) * (5.0 / 9.0);
  8. }
  9.  
  10. int main(void) {
  11. for(int i = 0; i < 100; i += 10){
  12. printf("%d : %f \n", i, func(i));
  13. }
  14. for(int i = 0; i < 100; i += 10){
  15. printf("%d : %f \n", i, func_ex_cast(i));
  16. }
  17. return 0;
  18. }
  19.  
  20.  
  21.  
  22.  
Success #stdin #stdout 0s 4984KB
stdin
Standard input is empty
stdout
0 : -17.777779 
10 : -12.222222 
20 : -6.666667 
30 : -1.111111 
40 : 4.444445 
50 : 10.000000 
60 : 15.555555 
70 : 21.111111 
80 : 26.666666 
90 : 32.222221 
0 : -17.777779 
10 : -12.222222 
20 : -6.666667 
30 : -1.111111 
40 : 4.444445 
50 : 10.000000 
60 : 15.555555 
70 : 21.111111 
80 : 26.666666 
90 : 32.222221