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)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay