87. const n=10; var a:array[1..n,1..n] of integer; i,j:integer; begin for i:=1 to n do begin for j:=1 to i-1 do a[i,j]:=0; for j:=i to n do a[i,j]:=j-i+1; end; for i:=1 to n do begin for j:=1 to n do write(a[i,j]:3); writeln; end; end.
88. const n=10; var a:array[1..n,1..n] of integer; i,j:integer; begin for i:=1 to n do begin for j:=1 to n do a[i,j]:=0; a[i,i]:=1; a[i,n-i+1]:=1; end; for i:=1 to n do begin for j:=1 to n do write(a[i,j]:3); writeln; end; end.
Answers & Comments
Verified answer
87.const n=10;
var a:array[1..n,1..n] of integer;
i,j:integer;
begin
for i:=1 to n do
begin
for j:=1 to i-1 do a[i,j]:=0;
for j:=i to n do a[i,j]:=j-i+1;
end;
for i:=1 to n do
begin
for j:=1 to n do write(a[i,j]:3);
writeln;
end;
end.
Результат:
1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9
0 0 1 2 3 4 5 6 7 8
0 0 0 1 2 3 4 5 6 7
0 0 0 0 1 2 3 4 5 6
0 0 0 0 0 1 2 3 4 5
0 0 0 0 0 0 1 2 3 4
0 0 0 0 0 0 0 1 2 3
0 0 0 0 0 0 0 0 1 2
0 0 0 0 0 0 0 0 0 1
88.
const n=10;
var a:array[1..n,1..n] of integer;
i,j:integer;
begin
for i:=1 to n do
begin
for j:=1 to n do a[i,j]:=0;
a[i,i]:=1; a[i,n-i+1]:=1;
end;
for i:=1 to n do
begin
for j:=1 to n do write(a[i,j]:3);
writeln;
end;
end.
Результат:
1 0 0 0 0 0 0 0 0 1
0 1 0 0 0 0 0 0 1 0
0 0 1 0 0 0 0 1 0 0
0 0 0 1 0 0 1 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 1 0 0 1 0 0 0
0 0 1 0 0 0 0 1 0 0
0 1 0 0 0 0 0 0 1 0
1 0 0 0 0 0 0 0 0 1