BackJoon Algorithm - Java
문제
풀이
- 처음 입력 받은 배수를 다음 입력받은수로 나머지를구하고 0이면 배수이다.
import java.util.Scanner;
public class Back_4504 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int number=sc.nextInt();
boolean run =true;
while(run){
int multiple_count=sc.nextInt();
if(multiple_count==0){
break;
}
if(multiple_count%number==0){
System.out.println(multiple_count+" is a multiple of "+number+".");
}
else{
System.out.println(multiple_count+" is NOT a multiple of "+number+".");
}
}
sc.close();
}
}
댓글남기기