Skip to content

Instantly share code, notes, and snippets.

@JorgeOlvera
Created January 31, 2014 16:55
Show Gist options
  • Save JorgeOlvera/8736174 to your computer and use it in GitHub Desktop.
Save JorgeOlvera/8736174 to your computer and use it in GitHub Desktop.
//for any given pair of intergers, print a statement that states whether the second is a multiple of the fist
import java.util.Scanner;
public class findMultiples {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("Please introduce two numbers, separated by the enter key");
int a = input.nextInt();
int b = input.nextInt();
boolean answer = multipleNumber(a,b);
if (answer == true){
System.out.println(b + "is a multiple of " + a);
}
else {
System.out.println(b + "is not a multiple of " + a);
}
}
public static boolean multipleNumber(int a, int b){
if (b%a == 0){
return true;
}
else {
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment