C# While Loop1 min read

A while loop is an entry-control loop that evaluates the condition before executing the block of the loop. If the condition is true then the body of the loop is executed else the loop will be skipped. The loop continues until the condition stated found to be false.

while loop Flowchart:

While Loop

The syntax for while loop in C#:

You should use a while loop, where the exact number of iterations is not known but the loop termination condition, is known.


Example of C# While Loop

Output:


MORE

Keith Number Program in C

In this tutorial, we will write a Keith number in C. It is one of the most asked questions in an interview. Before that, you …
Read More

Keith Number Program in C++

In this tutorial, we will write a Keith number in C++. It is one of the most asked questions in an interview. Before that, you …
Read More

Singly linked list Program C++

In this tutorial, we will write a C++ program to implement singly linked list. In this program, we will create a separate function for each …
Read More

Fascinating Number Program in C

In this tutorial, we will write a C program to check whether the given number is a Fascinating number or not. You may go through …
Read More

Peterson Number in C

In this tutorial, we will learn about the Peterson number and check if the number is Peterson or not in C. What is Peterson Number? …
Read More

Peterson Number in C++

In this tutorial, we will learn about the Peterson number and write a C++ program to check if the given number is a Peterson number …
Read More