初学者内容写详细点。感激啦!
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
------解决方案--------------------
这会有时间正好写一个,就是用到了二维数组。
- SQL code
declare type t_type is table of number index by binary_integer; type tt_type is table of t_type index by binary_integer; n number := &n; tt_array tt_type;begin tt_array(1)(1) := 1; tt_array(2)(1) := 1; tt_array(2)(2) := 1; for i in 3 .. n loop tt_array(i)(1) := 1; for j in 2 .. i - 1 loop tt_array(i)(j) := tt_array(i - 1) (j - 1) + tt_array(i - 1) (j); end loop; tt_array(i)(i) := 1; end loop; for i in 1 .. tt_array.count loop for j in 1 .. i loop dbms_output.put(tt_array(i) (j)); dbms_output.put(' '); end loop; dbms_output.put_line(''); end loop;end;