Do-while loop
The do-while
construct consists of a process symbol and a condition. First, the code within
the block is executed, and then the condition is evaluated. If the condition is
true the code within the block is executed again.
Syntax of do-While loop
do
{
statements;
} while ( expression );
|
Example of do-while loop
namespace ConsoleApplication1
{
class do_while_LoopExampleProgram
{
static void Main(string[] args)
{
int i = 0;
i = 60;
do
{
Console.WriteLine("value of i is- " + i.ToString());
i = i + 60;
} while (i < 20000);
Console.Read();
}
}
}
|