본문 바로가기
PROGRAMMING CODE/JAVA

[BAEKJOON] No.2522 JAVA

by daye_ 2021. 10. 14.

별 찍기 -12

import java.util.Scanner;

public class Main {
	
	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=n-i; j>0; j--) System.out.print(" ");
	    	for(int k=1; k<=i; k++) System.out.print("*");
	    	System.out.println();
	    }
	    for(int i=n-1; i>0; i--) {
	    	for (int j=i; j<n; j++)System.out.print(" ");
	    	for(int k=i; k>0; k--) System.out.print("*");
	    	System.out.println();
	    }
	    
		sc.close();
	}
}

'PROGRAMMING CODE > JAVA' 카테고리의 다른 글

[BAEKJOON] No.2556 JAVA  (0) 2021.10.14
[BAEKJOON] No.2446 JAVA  (0) 2021.10.14
[BAEKJOON] No.2445 JAVA  (0) 2021.10.14
[BAEKJOON] No.2444 JAVA  (0) 2021.10.14
[BAEKJOON] No.2884 JAVA  (0) 2021.10.14