본문 바로가기
PROGRAMMING CODE/JAVA

[BAEKJOON] No.2444 JAVA

by daye_ 2021. 10. 14.

별찍기 -7

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

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

[BAEKJOON] No.2522 JAVA  (0) 2021.10.14
[BAEKJOON] No.2446 JAVA  (0) 2021.10.14
[BAEKJOON] No.2445 JAVA  (0) 2021.10.14
[BAEKJOON] No.2884 JAVA  (0) 2021.10.14
[BAEKJOON] No.1000 JAVA  (0) 2021.10.14