Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C# code?
static void Main(string[] args)
{
int i= 0,k;
label: Console.WriteLine(i);
if (i == 0)
goto label;
Console.ReadLine();
}

What will be the output of the following C# code?
static void Main(string[] args)
{
int i= 0,k;
label: Console.WriteLine(i);
if (i == 0)
goto label;
Console.ReadLine();
}
a) 0 0 0 0
b) 0 0 0
c) 0 infinite times
d) 0

Answer: c
Explanation: Since, if condition is always true. Loop will continue executing always without any end condition.
Output: 0 0 0….

Join The Discussion