public class 魏功豪_聖誕樹 {
public static void main (String[] args) {
int Line = 4;
for (int i = 1; i <= Line; i++) {
for (int j = 0; j <= i; j++) {
for (int k = 1; k <= (Line - j); k++) {
System.out.print(" ");
}
for (int l = 1; l <= 1 + (j * 2); l++) {
System.out.print("▲");
}
System.out.println("");
}
}
for (int z = 1; z <= Line; z++) {
for (int x = 1; x <= Line; x++) {
System.out.print(" ");
}
System.out.println("▲");
}
}
}
沒有留言:
張貼留言