How do i also use multiplication and addition in one line?

sorry @xfpd you were right the first time - I spoke too fast and did not take into account the first operator was *

In the expression F = C * 9/5 + 32 , the multiplication and division operators have the same precedence level and are evaluated from left to right due to left-to-right associativity.

Therefore, C * 9 is computed first, then the result is divided by 5, and finally, 32 is added.

So if C is a float, then the math will be correct as C * 9 will be a float

if C is an int, then it's a challenge and you'll need indeed to throw those .0 in the math operations

1 Like