for(int i=1;i<=5;i++) {
for(int j=1;j<=5;j++) {
System.out.printf("%d ", i);
}
System.out.println();
}
System.out.println();
for(int i=1;i<=5;i++) {
for(int j=1;j<=5;j++) {
System.out.printf("%d ", j);
}
System.out.println();
}
System.out.println();
for문 printf
public static void main(String[] args) {
for(int i=1;i<=9;i++) {
for(int j=2;j<=4;j++) {
System.out.printf("%d * %d = %2d \t", j, i, i*j);
}
System.out.println();
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a, b, tmp;
System.out.print("a, b 값을 입력하세요.> ");
a = sc.nextInt();
b = sc.nextInt();
if(a<b)
{
tmp = a;
a = b;
b = tmp;
}
for(int i=1;i<=9;i++) {
for(int j=a;j>=b;j--) {
System.out.printf("%d * %d = %2d \t", j, i, i*j);
}
System.out.println();
}
sc.close();
}
정렬할 땐 무조건 a, b, tmp (=order by 정렬) SQL 나오기 전에
셀렉트 소트??
'개발일지 > Java + Spring' 카테고리의 다른 글
211019 Java - while (0) | 2021.10.19 |
---|---|
JAVA 211019 - today (0) | 2021.10.19 |
switch문 - 가위바위보 (0) | 2021.10.18 |
switch문 - 수우미양가 성적 출력 (0) | 2021.10.18 |
백준 알고리즘(Java) - 45분 일찍 알람 설정 (0) | 2021.10.17 |