공부기록/백준

[백준] 2439번 별찍기 -2

메델 2023. 2. 25. 12:11

2439번 별찍기-2

 

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