What is the syntax of nested do-while loop?
Answers
Answered by
0
A nested while loop is a while statement inside another while statement. In a nested while loop, one iteration of the outer loop is first executed, after which the inner loop is executed. The execution of the inner loop continues till the conditiondescribed in the inner loop is satisfied.
Answered by
0
Using C#, the syntax of the nested do-while loop, i can give an example of this below:
using System;
namespace Loop
{
class NestedWhileLoop
{
public static void Main(string[] args)
{
int i=0;
do
{
int j=0;
do
{
Console.Write("({0},{1}) ", i,j);
j++;
} while (j<2);
i++;
Console.WriteLine();
} while (i<2);
}
}
}
so here the output will be:
(0,0) (0,1)
(1,0) (1,1)
hope it helps
Similar questions