Posts: 82
Threads: 26
Joined: Jul 2014
Reputation:
0
printf("%f",3 / 2); is printing 0.00000 why? Please help me..
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
Integer divided by integer remains integer. It doesn't magically change type. For integer divisions, any fractional part in the outcome is discarded and no rounding is performed.
Posts: 1,801
Threads: 27
Joined: Mar 2009
Reputation:
0
printf("%f",Float:3 / Float:2);
or
printf("%f",3.0 / 2.0);
Posts: 1,208
Threads: 36
Joined: Apr 2015
One argument must be characteristic of the float
PHP код:
printf("%f",3 / 2.0); //1.5
printf("%f",3.0 / 2); //1.5