www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=574&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 = 1; i < 10; i++) {
for (int j = s; j <= e; j++) {
System.out.print(j + " * " + i + " = ");
System.out.printf("%2d", j * i);
System.out.print(" ");
}
System.out.println();
}
} else {
for (int i = 1; i < 10; i++) {
for (int j = s; j >= e; j--) {
System.out.print(j + " * " + i + " = ");
System.out.printf("%2d", j * i);
System.out.print(" ");
}
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) - 1341 : 구구단2 (0) | 2020.09.09 |