if (num1 > num2)
while (num1 > num2)
cout << num2 <<endl;
If I input 20 for num1 and 10 for num2 why does it print from 11 to 20 instead of 11 to 19? I want it to print from 11 to 19. I know this is just some logic fail from me but I can't seem to know what it is. Thanks for your help
Because you at first increase num2 and only after that you print it. That is inside the condition num2 that is equal to 19 is less than num1 (20)/ So the control will be passed inside the loop. Then you increase the num2 and num2 becomes equal to 20. This value is outputed.