#include <iostream>
using namespace std;
int main() {
int n=10; //sets variable n equal to integer 10
while(n>0) { //Declares that the following block of code will keep repeating as long as n is greater than 0
cout<<"n is "<<n<<endl;//prints string "n is " followed by the value of n at this particular time in the loop.
n--; // subtracts 1 from the value of n.
}
return 0; //exits loop
}
OUTPUT:
[cms-opendata@localhost src]$ ./a.out
n is 10
n is 9
n is 8
n is 7
n is 6
n is 5
n is 4
n is 3
n is 2
n is 1