www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=2076&sca=20
JUNGOL
www.jungol.co.kr
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int s, e;
while (true) {
s = sc.nextInt();
e = sc.nextInt();
if (s > 1 && s < 10 && e > 1 && e < 10) {
break;
} else {
System.out.println("INPUT ERROR!");
}
}
if (s < e) {
for (int i = s; i <= e; i++) {
for (int j = 1; j < 10; j++) {
System.out.print(i + " * " + j + " = ");
System.out.printf("%2d", i * j);
System.out.print(" ");
if (j % 3 == 0) {
System.out.println();
}
}
System.out.println();
}
} else {
for (int i = s; i >= e; i--) {
for (int j = 1; j < 10; j++) {
System.out.print(i + " * " + j + " = ");
System.out.printf("%2d", i * j);
System.out.print(" ");
if (j % 3 == 0) {
System.out.println();
}
}
System.out.println();
}
}
}
}'Algorithm > Beginner Coder' 카테고리의 다른 글
| Jungol (Java) - 1307 : 문자사각형1 (0) | 2020.09.10 |
|---|---|
| Jungol (Java) - 2046 : 숫자사각형4 (0) | 2020.09.10 |
| Jungol (Java) - 1856 : 숫자사각형2 (0) | 2020.09.10 |
| Jungol (Java) - 1303 : 숫자사각형1 (0) | 2020.09.09 |
| Jungol (Java) - 1291 : 구구단 (0) | 2020.09.09 |