Download MetaTrader 5

output as zero

To add comments, please log in or register
foongshen
12
foongshen  

hi, as below is a simple code i had create. But y output will be zero ? it suppose be 87.5

int int_lower_shadow = 70;
int int_upper_shadow = 81;

Print(((int_lower_shadow / int_upper_shadow) * 100));

Thanks

Simon Gniadkowski
Moderator
18042
Simon Gniadkowski  
foongshen:

hi, as below is a simple code i had create. But y output will be zero ? it suppose be 87.5

Thanks

Because int_lower_shadow / int_upper_shadow is less than 1 and an int of less than 1 is 0

Read this: Type Casting

To add comments, please log in or register