DEV Community

madina1575
madina1575

Posted on

DO WHILE LOOP

do while loop - while loopning bir turi.

do while loop ham while loop bilan bir xil funksiyani bajaradi ammo while loop agar sharti to'g'ri bo'lmasa ichiga kirmaydi, do while loop da sharti to'g'ri bo'masa ham bir marta ishlaydi.

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

Masalan:

#include <iostream>

using namespace std;

int main()
{
    int i = 15;
    do
    {
        cout << "Hello World" << endl;
        i++;
    }while(i <= 10)
}
Enter fullscreen mode Exit fullscreen mode

bu yerda i 15 ga teng yani 10dan katta va shartga to'g'ri kelmaydi ammo u bir marta Hello World tekstini chiqarib beradi.

Top comments (0)

Image of DataStax

AI Agents Made Easy with Langflow

Connect models, vector stores, memory and other AI building blocks with the click of a button to build and deploy AI-powered agents.

Get started for free

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay