Complete the code to check if the number is positive.
int number = 10; if (number [1] 0) { Console.WriteLine("Positive number"); }
The condition number > 0 checks if the number is positive.
Complete the else-if condition to check if the number is zero.
int number = 0; if (number > 0) { Console.WriteLine("Positive number"); } else if (number [1] 0) { Console.WriteLine("Zero"); }
The condition number == 0 checks if the number is exactly zero.
Fix the error in the else-if ladder to correctly check if the number is negative.
int number = -5; if (number > 0) { Console.WriteLine("Positive number"); } else if (number == 0) { Console.WriteLine("Zero"); } else if (number [1] 0) { Console.WriteLine("Negative number"); }
The condition number < 0 correctly checks if the number is negative.
Fill both blanks to complete the else-if ladder that prints the correct message based on the number.
int number = 0; if (number [1] 0) { Console.WriteLine("Positive number"); } else if (number [2] 0) { Console.WriteLine("Negative number"); }
The first condition checks if number is greater than zero (positive), the second checks if less than zero (negative).
Fill all three blanks to complete the else-if ladder that prints the correct message for positive, zero, or negative numbers.
int number = 5; if (number [1] 0) { Console.WriteLine("Positive number"); } else if (number [2] 0) { Console.WriteLine("Zero"); } else { Console.WriteLine("[3] number"); }
The first condition checks if number is greater than zero (positive). The second checks if number equals zero. The else prints "Negative number" for all other cases.