본문으로 바로가기
728x90
반응형


 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.Scanner;
 
public class Solution {
    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<=i; j++) {
                        if(j<=i) {
                            System.out.print("*");
                        }
                    }
                    System.out.println();
                }
    }
}
cs

 

1
2
3
4
5
6
7
8
9
public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                for(int i=1; i<=n; i++) {
                    System.out.println("*".repeat(i));
                }
    }
}
cs
반응형

 

728x90
반응형