본문 바로가기
알고리즘/백준

[백준 10990번 ː 자바(JAVA)] 별 찍기 - 15

by 그릿er 2020. 7. 17.

 

 

 

 

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

import java.util.*;

 

public class Main {

 

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        

        for(int i=0; i<n; i++) {

            for(int j=1; j<n+i+1; j++) {

                System.out.print(j==n-|| j==n+i?"*":" ");

            }

            System.out.println();

        }

        

        

        sc.close();

 

    }

 

}

 

 

 

 

숏코딩 자바로 검색하니 1등! 사소하지만 너무 뿌듯하네요.