Skip to content

Instantly share code, notes, and snippets.

@dalcon10028
Created January 9, 2020 03:00
Show Gist options
  • Select an option

  • Save dalcon10028/97fabe1142a7fdfa06a76ad3acccfd48 to your computer and use it in GitHub Desktop.

Select an option

Save dalcon10028/97fabe1142a7fdfa06a76ad3acccfd48 to your computer and use it in GitHub Desktop.
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
while (true) {
int num1 = sc.nextInt();
int num2 = sc.nextInt();
if (num1+num2==0) break; // 두 입력값이 0이면 종료
if (num2 % num1 == 0) { // 약수라면
System.out.println("factor");
} else if (num1 % num2 == 0){ // 배수라면
System.out.println("multiple");
} else { // 둘 다 아니라면
System.out.println("neither");
}
}
sc.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment