This content originally appeared on DEV Community and was authored by Sanjar Rashidov
Do while loop bu while loop bilan bir xil. Ammo “do while loop“ni sharti birinchi holda false bo’lsa ham dastur bir marta ishga tushadi.
Syntax of do while loop:
do
{
statement
++/–
}while(condition)
Masalan:
#include <iostream>
using namespace std;
int main()
{
int n = 1;
do
{
cout << n << endl;
n++;
}while(n <= 7);
return 0;
}
This content originally appeared on DEV Community and was authored by Sanjar Rashidov