Q:

while loop c#

// To forcibly exit a while loop use 'break'
while (true)
{
	// Do something
  
	if (conditional)
    {
    	break;
  	}
}
6
int i = 0;
while (i < 5) 
{
  Console.WriteLine(i);
  i++;
}
3
int i = 0;

while (i < 10)
{
    Console.WriteLine("Value of i: {0}", i);

    i++;
}
7
int n = 0;
while (n < 5)
{
    Console.WriteLine(n);
    n++;
}
4

New to Communities?

Join the community