24-04-2008, 05:54 PM
|
| Addicted to Computer | | Join Date: Sep 2007 Location: ------------ Age: 34
Posts: 1,309
Contact Number: --------------- Program / Discipline: BSIT Class Roll Number: 07-01 | |
Table of 5-10 Using Nested Loops Table of 5-10 Using Nested Loops Here is the source code for a Nested loop to write the Table of 5 upto 10 Code: #include <iostream>
using namespace std;
int tableof=5;
int tablefrom=5;
int tableto=10;
int counter=1;
int main()
{
while(tablefrom<=tableto)
{
cout<<endl<<"Table of "<<tableof<<endl;
while(counter<=10)
{
cout<<tableof<<"x"<<counter<<"="<<tableof*counter<<endl;
counter++;
}
tablefrom++;
tableof++;
counter=1;
/*Here we have freed up the counter ,Because we have to use it
to write the next loop*/
}
return 0;
} |