Sunday 10 August 2014

Write a Program in C++ which use Nested For loops

Structure of the Problem Requirements 


In this problem we will learn how to make a nested loops in C++ program. Nested Loops commonly used when we deal with 2D Arrays, Sorting and arranging data . The Principle of the nested loops is that when the inner loop complete its all iterations then the control goes to outer loo and when it process (increment or decrement) then the control again shift to the inner loop and this process continue until the completion of both loops. Here is the source code of the Nested Loops which help you in better understanding .

Source Code  


#include<iostream>
using namespace std;
int main ()
{
for (int i =6;i<11;i++)
{
for (int k =1;k<6;k++)
{
cout<<"Inner Loop " <<k <<endl;
}
cout<<"****** OUTER LOOP VALUE *****"<<i<<endl;
}
}

Output of the Program

C++ Programming
Nested Loops in C++


Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment