Home »

Give the syntax of using the while loop in a C# program?

Question ListCategory: C#.NETGive the syntax of using the while loop in a C# program?
jully882 author asked 9 years ago
1 Answers
ethanbrown author answered 8 years ago

The syntax of using the while loop in C# is: while(condition) //condition { //statements } You can find an example of using the while loop in C#: int i = 0; while(i < 5) { Console.WriteLine("{0} ", i); i++; } The output of the preceding code is: 0 1 2 3 4 .

Please login or Register to Submit Answer