- Back to Home »
- C#.NET »
- C#.NET Do While
Posted by :
Sudhir Chekuri
Thursday, 31 December 2015
Do while loop executes a set of statements inside it atleast once and repeated till the condition is met.
Syntax
Do
{
<statements>
} while(condition);
C#.NET DoWhile Example program
Program
Output
0
1
2
3
4
5
6
7
8
9
Syntax
Do
{
<statements>
} while(condition);
C#.NET DoWhile Example program
Program
using System;
namespace DoWhileLoop
{
class Program
{
static void Main(string[] args)
{
int i = 0;
do
{
Console.WriteLine(i);
i++;
} while (i < 10);
Console.ReadKey();
}
}
}
Output
0
1
2
3
4
5
6
7
8
9