问题 填空题

[说明] 打印输出10行杨晖三角形。形式如下:杨晖三角形:11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 11 6 15 20 15 6 11 7 21 35 35 21 7 11 8 28 56 70 56 28 8 11 9 36 84 126 126 84 36 9 1 class yanghui { public static void main (String args [] ) { int i, j; (1) int yanghui [] []; System. out. println( “杨晖三角形:” ); yanghui = new int [ yhleve1] []; for(i =0;i < yanghui, length; i + + ) yanghui[i] = new int [i + 1]; (2) for( (3) ) { 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; } for ( i=0; i < yanghui. length; i + + ) { for(j =0;j < yanghui[i]. length; j + + ) (4) System. out. println( ); } } }

答案

参考答案:int yhleve1 = 10;

解析:yanghui [0] [0] = 1;i=1; i < yanghui, length; i + +System. out. print ( yanghui [i] [j] +" ");

单项选择题 A1型题
单项选择题