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 x;
for (x = 1; x <= 3; x++)
{
int j = 1;
do
{
j++;
}while (x % j == 2);
Console.WriteLine(x + ” ” + j);
}
Console.ReadLine();
}

What will be the output of the following C# code?
static void Main(string[] args)
{
int x;
for (x = 1; x <= 3; x++)
{
int j = 1;
do
{
j++;
}while (x % j == 2);
Console.WriteLine(x + ” ” + j);
}
Console.ReadLine();
}
a) 1 12 1 3 1
b) 1 12 13 1
c) 12 22 32
d) 11 21 31

Answer: c
Explanation: Output : 12 22 32

Join The Discussion