1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); in.close(); for (int i = 1; i <= N; i++) { //N이 행의 개수임 그러니까 입력 받은 N값 만큼 행을 출력하겠다는 소리임 for (int j = 1; j <= i; j++) { // 이게 행 안에 들어있는 별의 개수임. 행의 갯수 만큼 별을 출력하겠다는 것 System.out.print("*"); } System.out.println(); } } } | cs |
'Algorithm' 카테고리의 다른 글
백준 문자열 9086 (0) | 2023.08.26 |
---|---|
백준 단어 길이 재기 2743 (0) | 2023.08.26 |
백준 문자열 27866 (0) | 2023.08.24 |
백준 알람 45분 빨리 2884 (0) | 2023.08.24 |
백준 과제 안 내신 분 5597 (0) | 2023.08.24 |