Complete the code to print "Positive" if x is greater than 0.
x <- 5 if (x [1] 0) { print("Positive") }
The condition x > 0 checks if x is greater than zero.
Complete the code to print "Even" if number is divisible by 2.
number <- 4 if (number %% 2 [1] 0) { print("Even") }
The expression number %% 2 == 0 checks if number is divisible by 2 without remainder.
Fix the error in the if-else statement to print "Positive" or "Non-positive".
x <- -3 if (x [1] 0) { print("Positive") } else { print("Non-positive") }
The condition should use the greater than operator > to check if x is positive.
Fill in the blank to print "Adult" if age is 18 or more, otherwise "Minor".
age <- 20 if (age [1] 18) { print("Adult") } else { print("Minor") }
The condition age >= 18 checks if age is 18 or older. The else covers the case when age is less than 18.
Fill in the blanks to print "Positive", "Zero", or "Negative" based on x value.
x <- 0 if (x [1] 0) { print("Positive") } else if (x [2] 0) { print("Zero") } else { print("Negative") }
The first condition checks if x is greater than zero (positive). The second checks if x equals zero. Otherwise, x is negative.