+ 1
Why did this loop execute itslef 5 times?
https://code.sololearn.com/cNKy8KGbEylr/?ref=app Shouldn't it do it 4 times since a=100 and it is supposed to be executed when a<100?
2 Answers
+ 2
Be cause
0.01 < 100
10*0.01 = 0.1 < 100
10*0.1 = 1 < 100
10*1=10<100
and 10*10 =100 but the incrementation is do after
+ 1
0.01 ,i=1
0.10,i=2
1,i=3
10,i=4
100 but it's equal to a ,so it should be 4 as you saidđ€
float has less precision
use double ,