DEV Community

madina1575
madina1575

Posted on

WHILE LOOP

loop -halqa dep tarjima qilinadi.

Looplar c++ dasturlash tilida biror ishni qayta qayta bajarish uchun ishlatiladi.

Looplardan biri bo'lgan while loop ni o'rganamiz.

Sinteks:

while(expression)
{
statement;
increasment/decreasment;
}

Masalan:

#include <iostream>

using namespace std;

int main()
{
    int i = 50;
    while(i >= 1)
    {
        cout << "Hello World" << endl;
        i--;
    }
}
Enter fullscreen mode Exit fullscreen mode

bu yerda i o'zgaruvchisi orqali Hello World tekstini 50 marta chop eta olamiz. While loop ga birinchi marta kirganda bitta Hello World tekstini chop etadi va bittaga kamayadi chunki i-- decreasment qo'yilgan.

Top comments (0)

Billboard image

Imagine monitoring that's actually built for developers

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay