0.1 is 're-converted' to an int and so 0.1 becomes a rounded 0.
Carl Schreiber:
0.1 is 're-converted' to an int and so 0.1 becomes a rounded 0.
I changed variable type to 'double' and problem solved! thanks!!
0.1 is 're-converted' to an int and so 0.1 becomes a rounded 0.
Carl Schreiber: 0.1 is 're-converted' to an int and so 0.1 becomes a rounded 0.
You have the right idea, but no it never gets re-converted. It remains an integer during the entire process. It carries out integer division, not floating-point division.
In integer division, if the divisor is greater than the numerator, then the results are always 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
hi
Look at this part of code. It prints 0. I don't know why!
Any idea?