What will be the output of the following C# code?
static void Main(string[] args)
{
int i = 0;
while (i <= 50)
{
if (i % 10 == 0)
continue;
else
break;
i += 10;
Console.WriteLine(i % 10);
}
}
static void Main(string[] args)
{
int i = 0;
while (i <= 50)
{
if (i % 10 == 0)
continue;
else
break;
i += 10;
Console.WriteLine(i % 10);
}
}A. code prints output as 0 0 0 0 0
B. code prints output as 10 20 30 40 50
C. infinite loop but doesn't print anything
D. Code generate error
Answer: Option C

Join The Discussion