NESTED WHILE LOOP

madina1575

madina1575

Posted on November 5, 2024

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

💖 💪 🙅 🚩
madina1575
madina1575

Posted on November 5, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

NESTED WHILE LOOP
beginners NESTED WHILE LOOP

November 5, 2024

DO WHILE LOOP
beginners DO WHILE LOOP

November 5, 2024

ELSE IF
beginners ELSE IF

November 5, 2024

NESTES IF
beginners NESTES IF

November 5, 2024

FUNCTIONS
beginners FUNCTIONS

November 5, 2024