DEV Community

madina1575
madina1575

Posted on

NESTED WHILE LOOP

Nested so'zi - ichma - ich degan ma'noni bildiradi.

Nested while loop - while loop ichida xyana boshqa while loop ishlatish imkonini beradi.

Sinteks:
while(expression)
{
while(expression)
{
statement;
increasment/decreament;
}
statement;
increasment/decreasment;
}

Masalan:

#include <iostream>

using namespace std;

int main()
{

    int son = 5;
    int son2 = 5;

    while(son >= 1)
    {
        while(son2 >= 1)
        {
            cout << son2 << " ";
            son2--;
        }
        cout << endl;
        son--;
    }

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

bu yerda natija quyidagicha bo'ladi:
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1

Top comments (0)

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay