make a while loop 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: while in c#
using System;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
int i = 0;
while (true)
{
Console.WriteLine("i = {0}", i);
i++;
if (i > 10)
break;
}
}
}
}