首页>代码>java打印杨辉三角>/1203468137350144.java
public class yangHuiSanJiao {

    /**
     * Creates a new instance of <code>yangHuiSanJiao</code>.
     */
    public yangHuiSanJiao() {
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
         int i,j,n=8,l,r; 
         int a[]=new int[9];
      System.out.println(1);
      for(i=1;i<=n;i++) 
      { l=1;
        System.out.print(1+" "); 
        for(j=1;j<=i;j++) 
        { r=a[j]; 
          a[j]=l+r;   /*每个数是上面两数之和*/ 
          l=r; 
         System.out.print(a[j]+" "); 
        } 

        System.out.println(); 

      }

}
}
最近下载更多
wuziayng1232  LV10 2022年11月14日
CaoCaii  LV6 2022年6月15日
明123456  LV11 2021年5月27日
大兴西北  LV2 2020年12月13日
mengnan8989  LV22 2018年5月16日
773901419  LV1 2016年10月16日
terryang  LV19 2014年1月2日
renwoaoxiangwxk  LV1 2013年3月3日
最近浏览更多
try8023  LV18 1月16日
生米的  LV10 2023年3月3日
myBreaker  LV5 2023年1月11日
炫瓶百事可乐  LV1 2022年12月1日
wuziayng1232  LV10 2022年11月14日
CaoCaii  LV6 2022年6月15日
uni-code_0123  LV1 2022年6月12日
lwkjchen01 2022年5月7日
暂无贡献等级
mySong  LV11 2022年4月7日
luozf1990  LV3 2022年1月6日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友