Question: Write a Java program that first reads a positive integer from the user- let's call it howMany . Then the program reads howMany pairs of
Write a Java program that first reads a positive integer from the user- let's call it howMany. Then the program reads howMany pairs of integers - let's call them n1 and n2. For each pair, the program determines if the first component in the pair is a multiple of the second component, in other words, if n1 is a multiple of n2. For example if howMany is 5, your program will read 5 pairs of integers, and for each pair (n1, n2) it will decide if n1 is a multiple of n2.
Sample output:
How many numbers in input? -4 ERROR! Should be positive. REENTER: 5 Enter a pair of positive integers: 10 3 10 is NOT a multiple of 3.
Enter a pair of positive integers: -1 7 ERROR! Both should be positive. REENTER: 15 2 15 is NOT a multiple of 2.
Enter a pair of positive integers: 81 3 81 is a multiple of 3.
Enter a pair of positive integers: 121 11 121 is a multiple of 11.
Enter a pair of positive integers: 12 -7 ERROR! Both should be positive. REENTER: 256 16 256 is a multiple of 16.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
