inquiry about while loop
why does the programe output the last two numbers
5 1 respectively ??
they should be
using namespace std;
int i=1;int j=1; int n=5;
cout<<i<< " " <<j<< " ";
cout<<i<< " "<<j<<" ";
The loop will keep running as long as i < n. When i becomes 5, i < n becomes false, and the loop stops.
when the loop stops ,, the program execute the next statement after the loop??
Yes, when the loop ends it will run the code that is after the loop.
|when the loop stops ,, the program execute the next statement after the loop?|
Yes it continues execution from firs statement after body of loop
Topic archived. No new replies allowed.