rodrigopaitach:
Can anyone explain to me why this happens?
You might want to review Type Casting.
Since 15 and 100 are both ints, the resulting quotient is also an int. Then the int is target-typecasted to a double. If you want the resulting quotient to be a double, make either the dividend or divisor (or both) a double--for example, by adding a decimal point to one or both.
double result = 15.0/100.0;
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Can anyone explain to me why this happens?