[백준, BOJ 10991] 별 찍기 - 16 (java)
Problem Solving/BOJ

[백준, BOJ 10991] 별 찍기 - 16 (java)

728x90

출처-https://www.acmicpc.net/problem/10991

 

10991번: 별 찍기 - 16

예제를 보고 규칙을 유추한 뒤에 별을 찍어 보세요.

www.acmicpc.net


728x90

 

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		
		for (int i=1;i<=N;i++) {
			for (int j=N-i;j>0;j--)
				System.out.print(" ");
			System.out.print("*");
			for (int j=1;j<i;j++)
				System.out.print(" *");
			System.out.println();
		}
	}

}
728x90