Created
January 31, 2014 16:55
-
-
Save JorgeOlvera/8736174 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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