+ 2

I don't get how the following code produces 3 even when a single increment has been set. That's not the case with other values.

https://code.sololearn.com/WusDb5eQ3N2J/?ref=app

10th Nov 2021, 9:39 PM
Mohammed Qaif Gaffar
2 odpowiedzi
+ 3
Because u are using while loop which will add one three time to number variable
10th Nov 2021, 9:56 PM
Pariket Thakur
Pariket Thakur - avatar
+ 3
In the while loop, 1 will be added until number is 3. If you input a value >= 3, the while loop wil not be executed, instead the number will be returned as it is
10th Nov 2021, 9:56 PM
Lisa
Lisa - avatar