I'm writing a switch
statement and trying to print f
as a float. In this context a
is 40 and b
is 400, so I need to print out 0.1
My question is, since f
is an int
, how can I go about this? I've already tried using %f
instead of %d
and I've also cast a
as a float
. But every time it just prints 0.00000000
case '/': f = a / b; printf("f = %d\n", f);
Just to clarify all three values are ints.