打印下列图形!用pascal做!
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 11:34:40
打印下列图形!用pascal做!
6、 1 2 4 7 11 16 22
3 5 8 12 17 23
6 9 13 18 24
10 14 19 25
15 20 26
21 27
28用pascal打印出来!别只给我个打印!要做!
6、 1 2 4 7 11 16 22
3 5 8 12 17 23
6 9 13 18 24
10 14 19 25
15 20 26
21 27
28用pascal打印出来!别只给我个打印!要做!
var k,i,j,l:longint;
a:array[1..7,1..7]of longint;
begin
{二维数组初始化为
1
2 3
4 5 6
7 8 9 10
.}
k:=0;
for i:=1 to 7 do
for j:=1 to i do
begin
inc(k);
a[i,j]:=k;
end;
{按列主顺序输出就可以了}
for i:=1 to 7 do
begin
for l:=1 to i do write(' ');
for j:=i to 7 do write(a[j,i],' ');
writeln;
end;
end.
a:array[1..7,1..7]of longint;
begin
{二维数组初始化为
1
2 3
4 5 6
7 8 9 10
.}
k:=0;
for i:=1 to 7 do
for j:=1 to i do
begin
inc(k);
a[i,j]:=k;
end;
{按列主顺序输出就可以了}
for i:=1 to 7 do
begin
for l:=1 to i do write(' ');
for j:=i to 7 do write(a[j,i],' ');
writeln;
end;
end.