Identify and correct the errors in each of the following pieces of code. [Note: 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;
```
a) The semicolon at the end of the if condition should be removed. The closing double quote of the second Console.WriteLine should be inside the closing parenthesis.
b) The variable total should be initialized to zero.
c) The variable total should be initialized to zero.
d) The ++ operator should be changed to --; otherwise the loop will be an infinite loop if y is greater than 0 when the while statement is encountered. The closing curly brace for the while loop is missing.
You might also like to view...
The largest possible value for the Value property in a scroll bar is determined by
(A) the LargeChange property. (B) the Minimum property. (C) the Value property. (D) the Maximum property.
Object-oriented techniques work well in situations where ________ information systems are undergoing continuous maintenance, adaptation, and redesign.
A) complicated B) simple C) highly technical D) global