Advertisement
//C# Exmaple do-while loop
using System;
class DoWhileEx
{
public static void Main()
{
//Initializing the value of i
int i=0;
do
{
Console.WriteLine("i = " + i);
//Iterating the value of i
i++;
}while(i<5); //Condition of do-while loop
}
}
i = 0
i = 1
i = 2
i = 3
i = 4
Advertisement
//C# do-while example
using System;
class DoWhile
{
public static void Main()
{
//Initializing the value of i
int i=100;
do
{
Console.WriteLine("i = " + i);
//Iterating the value of i
i++;
}while(i<10); //Condition of do-while loop
}
}
i = 100
Advertisement
Advertisement
Please check our latest addition
C#, PYTHON and DJANGO
Advertisement