-
10991 별 찍기 - 16PS/백준 2022. 3. 13. 23:58
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(buf.readLine()); for(int i = 0; i < n; i++) { for(int j = 0; j <n - i -1; j++) { System.out.print(" "); } for(int k = 0; k < i+1; k++) { System.out.print("*"); if (k < i + 1) { System.out.print(" "); } } System.out.println(); } } }
'PS > 백준' 카테고리의 다른 글
10808 알파벳 개수 (0) 2022.03.15 10992 별 찍기 17 (0) 2022.03.14 2446 별 찍기 - 9 (0) 2022.03.13 2522 별 찍기 - 12 (0) 2022.03.12 2445 별 찍기 - 8 (0) 2022.03.10