while statements c# code example
Example 1: while loop in c#
int i = 0;
while (i < 10)
{
Console.WriteLine("Value of i: {0}", i);
i++;
}
Example 2: C# while
int n = 0;
while (n < 5)
{
Console.WriteLine(n);
n++;
}
Example 3: C# While Loop01
int counter = 0;
while (counter < 10)
{
Console.WriteLine($"Hello World! The counter is {counter}");
counter++;
}