본문 바로가기
with my rubber duck/codingTest

백준 2439 별 찍기 - 2 풀기

by stilinski 2022. 4. 11.
728x90

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		sc.close();
		
		for(int i = 0;i < n;i++) {
			for(int k = n-1;k>i;k--) {
				System.out.print(" ");
			}
			for(int j =0;j<=i;j++) {
				System.out.print("*");
			}
			System.out.println();
		}
		
	}
	
	

}

 

728x90

댓글