0
Two math functions
I am trying to convert temperature from F - C. The math is: F - 32 * (5/9) I tried that all on one line and can’t seem to get the code to run so I tried it on separate lines and using a variable for 5/9 and just outputs 0 https://code.sololearn.com/cvIL5b3B219V/?ref=app
3 odpowiedzi
+ 3
Thats because 5/9 is an integer divison, which yields 0.
type 5/9.0 for example to convert it to double.
+ 2
cool, thank you!
+ 1
check out the solutions for the "the c programming language" book, by ritchie et al.