主题:还有就是关于二维数组的杨辉三角是怎么算出来的
{public static void main (string args[])
{int i,j;
int yhlevel=10;
int yanghui[][];
system.out.println("yang hui san jiao xing:");
yanghui=new int[yhlevel][];
for(i=0;i<yanghui.length;i++)
yanghui[i]=new int[i+1];
yanghui[0][0]=1;
[color=FF0000]for(i=1;i<yanghui.length;i++)
{yanghui[i][0]=1;
for(j=1;j<yanghui[i].length-1;j++)
yanghui[i][j]=yanghui[i-1][j-1]+yanghui[i-1][j];
yanghui[i][yanghui[i].length-1]=1;
}[/color] for(i=1;i<yanghui.length;i++)
{for(j=1;j<yanghui[i].length;j++)
system.out.print(yanghui[i][j]+"");
system.out.println();
}
}
}
}
这里到底是怎样进行运算得出结果。
{int i,j;
int yhlevel=10;
int yanghui[][];
system.out.println("yang hui san jiao xing:");
yanghui=new int[yhlevel][];
for(i=0;i<yanghui.length;i++)
yanghui[i]=new int[i+1];
yanghui[0][0]=1;
[color=FF0000]for(i=1;i<yanghui.length;i++)
{yanghui[i][0]=1;
for(j=1;j<yanghui[i].length-1;j++)
yanghui[i][j]=yanghui[i-1][j-1]+yanghui[i-1][j];
yanghui[i][yanghui[i].length-1]=1;
}[/color] for(i=1;i<yanghui.length;i++)
{for(j=1;j<yanghui[i].length;j++)
system.out.print(yanghui[i][j]+"");
system.out.println();
}
}
}
}
这里到底是怎样进行运算得出结果。