Algorithm
백준 별 찍기 2438
hyunjun's developing 🏣
2023. 8. 24. 16:46
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 |