알고리즘/백준
[백준 2522번 ː 자바(JAVA)] 별 찍기 - 12
그릿er
2020. 7. 17. 19:35
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import java.util.*;
public class Main {
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt();
for(int i=0,k=n; i<2*n; i++) { for(int j=0; j<n; j++) { System.out.print(j<k-1?" ":"*"); } if(i<n-1) k--; else k++; System.out.println(); }
sc.close();
}
}
|