포스트

직각삼각형 출력하기

https://school.programmers.co.kr/learn/courses/30/lessons/120823

문제

  • 문제 풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.