import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @author aram.park
*/
public class list4_22 {
public static void main(String[] args) throws Exception {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.println("数値を入力しましょう。");
String line = read.readLine();
int n = Integer.parseInt(line);
pira(n);
} catch (IOException e) {
System.out.println(e);
} catch (NumberFormatException e) {
System.out.println("数値を入力してください。再入力します。");
}
}
public static void pira(int n) {
for (int i = 0; i <= n; i++) {
for (int j = n; j > i; j--) {
System.out.print(" ");
}
for (int j = 1; j <= ((i - 1) * 2 + 1); j++) {
System.out.print("*");
}
System.out.println("");
}
}
}
'Web Dev > JAVA' 카테고리의 다른 글
자바연수) chapter4 두번째문제 (0) | 2015.04.21 |
---|---|
자바연수) chapter4 마지막문제 (0) | 2015.04.21 |
자바연수) chapter4 test1 (0) | 2015.04.21 |
비즈리치자바연수 7장)charAt의 에러 해결 (0) | 2015.04.21 |
자바연수) 4월16일 (0) | 2015.04.17 |