Complete the code to check if the number is positive.
if (number [1] 0) { Console.WriteLine("Positive number"); }
The condition should check if the number is greater than zero to be positive.
Complete the code to print "Even" when the number is divisible by 2.
if (number [1] 2 == 0) { Console.WriteLine("Even"); }
The modulus operator '%' gives the remainder. If remainder is 0 when divided by 2, the number is even.
Fix the error in the if statement to correctly check if age is at least 18.
if (age [1] 18) { Console.WriteLine("Adult"); }
To check if age is at least 18, use '>=' which means greater than or equal to 18.
Fill both blanks to print "Teenager" if age is between 13 and 19 inclusive.
if (age [1] 13 && age [2] 19) { Console.WriteLine("Teenager"); }
The age should be greater than or equal to 13 and less than or equal to 19 to be a teenager.
Fill the blanks to print "Grade A" if score is above 90, "Grade B" if score is above 80, else "Grade C".
if (score [1] 90) { Console.WriteLine("Grade A"); } else if (score [2] 80) { Console.WriteLine("Grade B"); } else { Console.WriteLine("Grade C"); }
Use '>' to check if score is strictly greater than 90 or 80. The else covers scores less than or equal to 80.