Basic Nested While Loop Example in C++ || While Loop || C++
In this, we are going to see how to use nested While loop, in C++.


The Code given below can be used in TURBO C++ Compilers: -

#include <stdio.h>
#include<conio.h>
void main()
{Nested_While_Loop_cpp
    clrscr();
    int i = 1;
    while (i <= 5)
    {
        int j = 1;
        while (j <= 5)
        {
            cout << i << " " << j << "\n";
            j++;
        }
        i++;
    }

    getch();
}

//...........Coded by Rishab Nair

 

The Code given below can be used in gcc/g++ Compilers: -

#include <iostream>
using namespace std;

int main()
{
    int i = 1;
    while (i <= 5)
    {
        int j = 1;
        while (j <= 5)
        {
            cout << i << " " << j << "\n";
            j++;
        }
        i++;
    }
}

//...........Coded by Rishab Nair
    

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post