23. do while loop

sunnat_qayumov

Sunnat Qayumov

Posted on October 13, 2024

23. do while loop

a) do while loop qachon ishlatiladi?

C# dasturlash tilida do while sikli (do-while loop) ma'lum bir kodni kamida bir marta bajarishni ta'minlaydi va undan keyin shart tekshiriladi. Bu shuni anglatadiki, sikl tanasi avval bir marta bajariladi, keyin shart tekshiriladi, agar shart to'g'ri bo'lsa, sikl davom etadi, aks holda u tugaydi.

*b) Quyidagi kodning natijasini tushuntiring: *

int i = 5;
do
{
    Console.WriteLine(i);
    i++;
}while(i < 5);
Enter fullscreen mode Exit fullscreen mode

int tipida i nomli o'zgaruvchi e'lon qilib, uni 5 ga tenglaymiz. do while siklini e'lon qilamiz. u birinchi martta aylanib 0 ni chop etadi va shartni tekshiradi. sharti true bolganidan keyin shart qayta - qayta aylanadi.

*Javob: *

0, 1, 2, 3, 4

💖 💪 🙅 🚩
sunnat_qayumov
Sunnat Qayumov

Posted on October 13, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024

How to Use KitOps with MLflow
beginners How to Use KitOps with MLflow

November 29, 2024

Modern C++ for LeetCode 🧑‍💻🚀
leetcode Modern C++ for LeetCode 🧑‍💻🚀

November 29, 2024