๋ฐ์ํ
import java.util.Scanner;
// 2444 ๋ณ ์ฐ๊ธฐ - 7
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
in.close();
String b = " ";
String s = "*";
for (int i = 1; i <= n; i++) {
for (int j = 0; j< n-i; j++) {
System.out.print(b);
}
for (int j = 0; j < i*2-1; j++) {
System.out.print(s);
}
System.out.println();
}
for (int i = n-1; i >= 0; i--) {
for(int j = 0; j < n-i; j++) {
System.out.print(b);
}
for(int j = 0; j < i*2-1; j++) {
System.out.print(s);
}
System.out.println();
}
}
}
๋ฐ์ํ
'๐ธ Algorithm > ๐ธ ๋ฐฑ์ค BaekJoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][java][1157][๋จ์ด ๊ณต๋ถ] (1) | 2024.02.08 |
---|---|
[๋ฐฑ์ค][java][10988][ํฐ๋ฆฐ๋๋กฌ์ธ์ง ํ์ธํ๊ธฐ] (0) | 2024.02.07 |
[๋ฐฑ์ค][java][3003][ํน, ํธ, ๋ฃฉ, ๋น์, ๋์ดํธ, ํฐ] (0) | 2024.02.03 |
[๋ฐฑ์ค][java][25083][์์น] (0) | 2024.01.29 |
[๋ฐฑ์ค][java][11718][๊ทธ๋๋ก ์ถ๋ ฅํ๊ธฐ] (0) | 2024.01.28 |