0

Please tell me why it is also printing 11 ?

While ( i <= 10 ) https://code.sololearn.com/co6zHb8oah6O/?ref=app

27th Feb 2022, 12:42 PM
Abhay mishra
Abhay mishra - avatar
5 ответов
+ 2
Because of i<=10. Try this instead i < 10
27th Feb 2022, 12:46 PM
Simba
Simba - avatar
+ 1
i <= 10 means i less than or equal to 10 whereas i isn't equal to 10 in i < 10
27th Feb 2022, 12:55 PM
Simba
Simba - avatar
+ 1
Abhay mishra i <= 10 means less or equal to 10 10 <= 10 //returns true So i would be 10 it will satisfy condition and code inside if block would be execute so it will print 11
27th Feb 2022, 1:27 PM
A͢J
A͢J - avatar
0
Yes sir when i wrote i<10 it work . But please tell me reason why i <= 10 is wrong . I mean it should not be more than 10 than why is it ?
27th Feb 2022, 12:48 PM
Abhay mishra
Abhay mishra - avatar