public class StarTest {
public static void main(String args[]) {
int input = 5;
int st = 0;
input = (input % 2 == 0) ? input - 1 : input;
for (int line = 0; line < input; line++) {
for (int put = 0; put < (input - st); put++) {
System.out.print((put >= st) ? "*" : " ");
}
st = line < (input / 2) ? st + 1 : st - 1;
System.out.println();
}
}
}
설명
'대학 생활 > JAVA' 카테고리의 다른 글
| [JAVA] 구구단 3단씩 출력(try-catch 사용)_02 (0) | 2013.10.10 |
|---|---|
| [JAVA] 구구단 3단씩 출력(try-catch 사용)_01 (0) | 2013.10.08 |
| [JAVA] * 별 출력하기_07 나비2 (0) | 2013.10.04 |
| [JAVA] * 별 출력하기_06 나비 (0) | 2013.10.04 |