实验四
2019-03-31 17:18 太阳* 阅读(127) 评论(1) 编辑 收藏 举报public class yanghuisanjiao{
public static void main(String[] args){
int i=1;
int yh[] = new int[8];
for(i=0;i<8;i++) {
yh[i]=1;
for (int j=i-1;j>0;j--){
yh[j]= yh[j-1]+yh[j];
}
for (int j=0;j<=i;j++) {
System.out.print(yh[j]+"\t");
}
System.out.println();
}
}
}
实验结果
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
实验心得:代码在运行过程中出现了一些错误,大多数错误都是由于自己粗心大意,马虎造成,不过最后请教同学,都做了改正。