Answer:
see explaination for code
Step-by-step explanation:
Implement using JAVA
import java.util.Scanner;
public class Multiples {
public static boolean isMultiple(int first, int second){
if(second%first == 0)
return true;
else
return false;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
System.out.print("Enter one number: ");
int first = sc.nextInt();
System.out.print("Enter a second number: ");
int second = sc.nextInt();
if(isMultiple(first, second))
System.out.println(second+" is multiple of "+first);
else
System.out.println(second+" is not multiple of "+first);
System.out.print("Do you want to enter another pair(y/n)? ");
char c = sc.next().charAt(0);
if('y' != Character.toLowerCase(c))
break;
}
}
}
/*
Sample run:
Enter one number: 7
Enter a second number: 28
28 is multiple of 7
Do you want to enter another pair(y/n)? y
Enter one number: 8
Enter a second number: 24
24 is multiple of 8
Do you want to enter another pair(y/n)? y
Enter one number: 4
Enter a second number: 2
2 is not multiple of 4
Do you want to enter another pair(y/n)? n
*/