0
Trouble understanding While statement excercise
I was completing the While statement practice for C++. I got the correct answer but I can’t figure out why it’s correct. According to the code, shouldn’t this have put out other numbers too? Isn’t it basically taking any number less than 20 and adding 3 to it? So shouldn’t that result in more than just multiples of 3? This is probably super stupid but I’m brand new at this. https://code.sololearn.com/cn3XGh5mp4F2/?ref=app
4 Respuestas
+ 2
It's not taking any number because you assigned it to 3 and 3 does not equal more then
0
Oh I see. So instead of it adding 3 to every number under 20, its starting with 3, then adding 3 every time until that number is over 20. Got it. Thanks, mate. I feel dumb but that makes so much more sense now.
0
Yup try changing 20 to 100 and see what happens
0
And change 3 to 1 and see what happens , I suggests re writing the code from scratch till you understand it change the stuff around