When you multiply a fraction like 0.7 by 10.0 you receive a result that is close to 7.0 but not exactly 7.0. The result might for example be 6.999998. And if you assign that to an int variable the result will be 6.

The reason for that behavior is that in double variables fractions are stored in the binary system, not in the decimal system. For example 0.7 has no exact representation as a binary fraction. And that is why instead of 0.7 the double variable holds something like 0.699999999999.

15,996,250 members

http://postimg.org/image/4hetuo873/

Actually in last loop the value of float b is integer value itself like 1,2,3,etc...