Complete the code to check if a number is positive.
#include <iostream> int main() { int num = 5; if (num [1] 0) { std::cout << "Positive" << std::endl; } return 0; }
Complete the code to check if a number is between 1 and 10 (inclusive).
#include <iostream> int main() { int num = 7; if (num [1] 1 && num [2] 10) { std::cout << "In range" << std::endl; } return 0; }
Fix the error in the nested if statement to check if a number is positive and even.
#include <iostream> int main() { int num = 4; if (num > 0) { if (num [1] 2 == 0) { std::cout << "Positive and even" << std::endl; } } return 0; }
Fill both blanks to complete the nested conditional that prints if a number is positive and divisible by 3.
#include <iostream> int main() { int num = 9; if (num [1] 0) { if (num [2] 3 == 0) { std::cout << "Positive and divisible by 3" << std::endl; } } return 0; }
Fill all three blanks to create a nested conditional that prints if a number is negative, odd, and less than -10.
#include <iostream> int main() { int num = -15; if (num [1] 0) { if (num [2] 2 != 0) { if (num [3] -10) { std::cout << "Negative, odd, and less than -10" << std::endl; } } } return 0; }
