Question: Find and correct the error(s) in each of the following segments of code: a) For (i = 100, i >= 1, ++i) { Console.WriteLine(i); }
Find and correct the error(s) in each of the following segments of code:
a) For (i = 100, i >= 1, ++i)
{
Console.WriteLine(i);
}
b) The following code should display whether integer value is odd or even:
switch (value % 2)
{
case 0:
Console.WriteLine("Even integer");
case 1:
Console.WriteLine("Odd integer");
}
c) The following code should output the odd integers from 19 to 1:
for (int i = 19; i >= 1; i += 2)
{
Console.WriteLine(i);
}
d) The following code should output the even integers from 2 to 100:
counter = 2;
do
{
Console.WriteLine(counter);
counter += 2;
} While (counter < 100);
Step by Step Solution
3.50 Rating (160 Votes )
There are 3 Steps involved in it
a For should be for Also the commas in the for ... View full answer
Get step-by-step solutions from verified subject matter experts
