package liu0915; import java.util.Scanner; public class Yanghuisanjiao { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("请输入数字"); int n=sc.nextInt(); int arr[][]=new int[n][n]; for(int i=0;i<n-1;i++) { for(int j=0;j<=i;j++) { if(j==0||j==i) { arr[i][j]=1; System.out.print(arr[i][j]+" "); } else { arr[i][j]=arr[i-1][j]+arr[i-1][j-1]; } System.out.print(arr[i][j]+" "); } System.out.println(""); } } }