import java.util.Scanner;
public class demo4 {
? ? public static void main(String[] args) {
? ? ? ? Scanner scanner = new Scanner(System.in);
? ? ? ? System.out.println("請輸入等腰三角形的行數(shù):");
? ? ? ? int hangshu = scanner.nextInt();
? ? ? ? for (int i=1; i<=hangshu; i++){
? ? ? ? ? ? for (int j=0; j<hangshu-i; j++){
? ? ? ? ? ? ? ? System.out.print(" ");
? ? ? ? ? ? }
? ? ? ? ? ? for ( int j=0; j<2*i-1; j++){
? ? ? ? ? ? ? ? System.out.print("*");
? ? ? ? ? ? }
? ? ? ? ? ? System.out.println();
? ? ? ? }
? ? }
}
? // √