Question: Identify and correct the errors in each of the following pieces of code. [There may be more than one error in each piece of code.]

Identify and correct the errors in each of the following pieces of code. [There may be more than one error in each piece of code.]
a) if (age >= 65);
{
Console.WriteLine("Age greater than or equal to 65");
}
else
{
Console.WriteLine("Age is less than 65)";
}

b) int x = 1, total;
while (x <= 10)
{
total += x;
++x;
}

c) while (x <= 100)
total += x;
++x;

d) while (y > 0)
{
Console.WriteLine(y);
++y;

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a The semicolon at the end of the if condition should be removed The closing double quote of ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Visual C How Program Questions!