while loop

Sanjar Rashidov - Nov 2 - - Dev Community

Loop - halqa degani.
"While loop"ga bergan shartimiz noto'gri bo'lgunigacha "while loop"ga kiradi va berilgan ishni qayta bajaradi.

Syntax of while loop:
while(comdition)
{
statement
increament/decreament;(++/--)
}

Masalan:

#include <iostream>

using namespace std;

int main()
{
    int n = 1;

    while(n <= 7)
    {
        cout << n << endl;
        n++;
    }

    return 0;
}

Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . .