공부하시는대에 도움이 됐으면 좋겠습니다.
답안코드 확인해주세요!
더보기
import java.util.Scanner;
public class Main {
public static void call(int input1, int input2) {
if (input1 < input2) {
for (int i = input1; i <= input2; i++) {
System.out.println("== " + i + "dan" + " ==");
for (int j = 1; j <= 9; j++) {
String comp = Integer.toString(i * j);
if (comp.length() == 1)
System.out.println(i + " * " + j + " = " + i * j);
else
System.out.println(i + " * " + j + " = " + i * j);
}
System.out.println();
}
} else {
for (int i = input2; i <= input1; i++) {
System.out.println("== " + i + "dan" + " ==");
for (int j = 1; j <= 9; j++) {
String comp = Integer.toString(i * j);
if (comp.length() == 1)
System.out.println(i + " * " + j + " = " + i * j);
else
System.out.println(i + " * " + j + " = " + i * j);
}
System.out.println();
}
}
}
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int input1 = in.nextInt();
int input2 = in.nextInt();
call(input1, input2);
}
}
댓글