What will be the output of the following C# code?
static void Main(string[] args)
{
int i = 0, j = 0;
while (i < 2)
{
l1: i--;
while (j < 2)
{
Console.WriteLine("hi\n");
goto l1;
}
}
Console.ReadLine();
}
static void Main(string[] args)
{
int i = 0, j = 0;
while (i < 2)
{
l1: i--;
while (j < 2)
{
Console.WriteLine("hi\n");
goto l1;
}
}
Console.ReadLine();
}A. hi hi hi
B. hi hi
C. hi
D. hi hi hi..... infinite times
Answer: Option D

Join The Discussion