#1

printf("%f",3 / 2); is printing 0.00000 why? Please help me..
Reply
#2

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.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
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.
So what can i do?
Reply
#4

printf("%f",Float:3 / Float:2);
or
printf("%f",3.0 / 2.0);
Reply
#5

One argument must be characteristic of the float

PHP код:
printf("%f",2.0); //1.5

printf("%f",3.0 2); //1.5 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)