0
Why we got 1 in the output??
as we run the while loop for the first time...num has its value as 1 ...so after executing num= num+1 ..the first output should be 2 bcoz we are adding 1+1 ....pls explain how
2 Respuestas
+ 5
..... you are printing to the screen before the addition...
0
int num = 1;
while (num < 6) {
cout << "Number: " << num << endl;
num = num + 1;
}
/* Outputs
Number: 1
Number: 2
Number: 3
Number: 4
Number: 5
*/