Lecture 100
//Nested while loop
#include <iostream>
#include <conio.h>
using namespace std;
main ()
{
int row,col;
row=1;
while(row<3)//outer loop
{
col=1;
while(col<3){//inner loop
cout<<"Outer = "
<< row <<" Inner = "<<col<<endl;
col++;}
cout<<endl;
row++;
}
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10