public void example2() {
Scanner sc = new Scanner(System.in);
System.out.print("정수 입력 : ");
int input = sc.nextInt();
for(int row = 1; row <= input; row++) {
for(int col = 1; col <= input * 2 - 1; col++) {
// 마지막 줄의 별 갯수: input에 2를 곱한값의 -1
// row col || row col
// 1) 4 - 1 >= 1 || 4 + 1 <= 1
// 1) 4 - 1 >= 2 || 4 + 1 <= 2
// 1) 4 - 1 >= 3 || 4 + 1 <= 3
// 1) 4 - 1 >= 4 || 4 + 1 <= 4
// 1) 4 - 1 >= 5 || 4 + 1 <= 5
// 1) 4 - 1 >= 6 || 4 + 1 <= 6
// 1) 4 - 1 >= 7 || 4 + 1 <= 7
if( input - row >= col || input + row <= col) {
System.out.print(" ");
} else {
System.out.print("*");
}
}
System.out.println();
}
}
input - row >= col || input + row <= col