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