- 1
I don't understand this how it runs .
6 Réponses
+ 2
int age = 0;
while( age <= 10 ) {
cout << age << endl;
age++;
}
this while loop will print numbers from 0 to 10. Every time it loops, it increments age by 1. So when age will be at 10, it will be incremented to 11. Then while loop condition will be false because 11 > 10. So it will stop looping
+ 9
which and where? can you provide an example?
+ 1
while loop increment
0
I don't understand this
int num =1 ;
int number ;
int total=0;
while (num<=5){
cin >> number ;
total+ = number ;
num++;
}
cout <<total << endl;
0
if I enter 1 why does it execute 5