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
a The semicolon at the end of the if condition should be removed The closing double quote of ... View full answer
Get step-by-step solutions from verified subject matter experts
