Syntax of while loop in C sharp

Write the syntax of the while loop in the C# program.

E

Expert

Verified

Syntax of the while loop in the C# is as follows: 

while(condition) //condition

{

 //statements

}

An example of the while loop in C# is: 

int i = 0;

while(i < 5)

{

 Console.WriteLine("{0} ", i);

 i++;

}

Ooutput of the above code is: 0 1 2 3 4.

   Related Questions in DOT NET Programming

©TutorsGlobe All rights reserved 2022-2023.