DEV Community

Sabrina
Sabrina

Posted on

Loops(for while,do while)

a) for loopning sintaksisi qanday?

for(int variable = qiymati, variable = boshqa variable yoki son; increment or decrement;)
{

}
Enter fullscreen mode Exit fullscreen mode

b)while loop va do while o'rtasidagi farq nima?
Javob : do whileda bitta bo'sayam chiqarib beradi,whileda esa xatto bo'lsa hech nima chiqarmidi

c)Quiyidagi kodning natijasini toping :
int i = 0;
while(i < 5)
{
Console.WriteLine(i);
I++;
}
Xatto chunki incrementda I katta harfda yozilgan.Whileni ichida esa i kichkina

Top comments (0)