In integer math, 5/9 is 0, remainder 5. You want 5.0/9.0 instead.
In C, what you do with a result has no effect on how it’s computed. So even though c
is a float and you are storing the result of the math in a float
, the math is still integer math because 5
, 9
, f
and 32
are all integers.
solved Why does the c variable always output 0? [duplicate]