Find and correct the error(s) in each of the following segments of code: a) For (i =

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);
}

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);

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Visual C# How to Program

ISBN: 978-0134601540

6th edition

Authors: Paul J. Deitel, Harvey Deitel

Question Posted: