import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n - i; j++) { // 공백채우기
System.out.print(" ");
}
for(int k = 1; k <= (2*i)-1; k++) { // 짝수번째는 공백, 홀수번째는 *
if(k % 2 == 0) {
System.out.print(" ");
}else {
System.out.print("*");
}
}
System.out.println("");
}
}
}
'JAVA > 백준' 카테고리의 다른 글
[문자열 처리] 백준 10808 (0) | 2021.07.30 |
---|---|
[입출력] 백준 10992 (0) | 2021.07.30 |
[입출력] 백준 2446 (0) | 2021.07.30 |
[입출력] 백준 2445 (0) | 2021.07.30 |
[입출력] 백준 2441 (0) | 2021.07.30 |