Download MetaTrader 5

Division double wrong

To add comments, please log in or register
Suibo Wen
4627
Suibo Wen  

Hi, why code below output zero which is wrong?

double b=0;
b=30/100;
printf(b); //output zero wrong


and code below output is correct.

double b=0;

b=30.0/100.0;

printf(b); //output 0.3 correctly


Thanks.

Alain Verleyen
Moderator
32498
Alain Verleyen  
Suibo Wen
4627
Suibo Wen  
Thank you.
To add comments, please log in or register