主题:PASCAL 杨辉三角
program cc
var yh:array[1..10,1..10]of integer;
i,j:integer;
begin
yh[1,1]:=1;
for i:=2 to 10 do
begin
yh[i,1]:=1;yh[i,i]:=1;
for j:=2 to i-1 do
yh[i.j]:=yh[i-1,j-1]+yh[i-1,j];
end;
writeln('yang hui:');
for i:=1 to 10 do
begin
write('':40-3*i);
for j:=1 to i do write(yh[i,j]:6);
writeln;
end;
end.
HOHO 刚才看到有朋友问忍不住写了出来.小弟是菜鸟.希望大家没事到我论坛坐坐
http://www.vrcool.cn/bbs
var yh:array[1..10,1..10]of integer;
i,j:integer;
begin
yh[1,1]:=1;
for i:=2 to 10 do
begin
yh[i,1]:=1;yh[i,i]:=1;
for j:=2 to i-1 do
yh[i.j]:=yh[i-1,j-1]+yh[i-1,j];
end;
writeln('yang hui:');
for i:=1 to 10 do
begin
write('':40-3*i);
for j:=1 to i do write(yh[i,j]:6);
writeln;
end;
end.
HOHO 刚才看到有朋友问忍不住写了出来.小弟是菜鸟.希望大家没事到我论坛坐坐
http://www.vrcool.cn/bbs