adplus-dvertising
frame-decoration

Question

Select output for the following set of code :
static void Main(string[] args)
{
    int x;
    for (x = 10; x <= 15; x++)
    while (Convert.ToBoolean(Convert.ToInt32(x)))
    {
        do
        {
            Console.WriteLine(1);
            if (Convert.ToBoolean(x >> 1))
            continue;
        }while (Convert.ToBoolean(0));
        break;
    }
    Console.ReadLine();
}

a.

0 0 0….infinite times

b.

1 1 1….infinite times

c.

1 1 1 1 1 1

d.

System outofflow exception error

Posted under C# programming

Answer: (c).1 1 1 1 1 1

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Select output for the following set of code :