Question: Complete the code that reads in an even number R but not divisible by 10 from the user, Scanner kb = new Scanner(System.in); System.out.println(Enter an
Complete the code that reads in an even number R but not divisible by 10 from the user,
Scanner kb = new Scanner(System.in); System.out.println("Enter an even number but not divisible by 10: "); R = kb.nextInt(); while (R%2 ? 0 ? R%10 ? 0) { // Q1, Q2 and Q3 System.out.println("Enter an even number but not divisible by 10: "); R=kb.nextInt(); }
and repeats the keyboard reading process if this number is 0 or NEGATIVE. For example, the program will repeat the reading when 1, 3, and 10 are tried, until 12 is entered.
Q1: What is that missing part in code "R%2 ? 0"? Give a relational operator ==, !=, <, >, <=, or >= here:
Q2: What is that missing part in code "R%10 ? 0"? Give a relational operator ==, !=, <, >, <=, or >= here:
Q3: What is that missing part in code "0 ? R"? Give a relational connector && or || here to connect the solution of Q1 and Q2:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
