import java.util.Scanner;
class Tri {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("请输入等腰三角形行数:");
int h = sc.nextInt();
for (int i = 1; i <= h; i++) {
for (int j = i; j <= h; j++) {
System.out.print(" ");
}
for (int z = 0; z < 2 * i - 1; z++) {
System.out.print("*");
}
System.out.println();
}
}
}
|
|