public class Demo {

  /**
    *杨辉三角
    */

  public static void main(String[] args) {
        int n=5,i,j,k,m;     //n是指要实现输出的行数
                for(i=1;i<=n;i++){
                        m=1;
                        for(j=n-i;j>0;j--)
                                 System.out.print("    ");
                        System.out.print("1     ");
                        for(k=1;k<i;k++){
                                    m=m*(i-k)/k;
                                    System.out.print(m+"     ");    
                         }
                        System.out.println(" ");
                 }
  }
}