for循环练习--杨辉三角
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
package org.hanqi.zwxx; public class Yonghuisanjiao{ public static void main(String[] args) { // TODO 自动生成的方法存根 int[][] a=new int[8][]; for(int i=0;i<a.length;i++) { a[i]=new int[i+1]; for(int j=0;j<a[i].length;j++) { if(i==0||j==0||i==j) { a[i][j]=1; } else { a[i][j]=a[i-1][j-1]+a[i-1][j]; } System.out.print(a[i][j]+"\t"); } System.out.println(); } } }