Const m=4; k=5; var x:array[1..m] of integer; a:array[1..m,1..k] of real; i,j:integer; begin Randomize; writeln('Массив X:'); for i:=1 to m do begin x[i]:=random(10); write(x[i]:4); end; writeln; writeln('Массив A:'); for i:=1 to m do begin for j:=1 to k do begin a[i,j]:=(abs(j-3)-1.3)*(2*x[i]+0.5); write(a[i,j]:7:2); end; writeln; end; end.
Answers & Comments
Verified answer
Const m=4; k=5;var
x:array[1..m] of integer;
a:array[1..m,1..k] of real;
i,j:integer;
begin
Randomize;
writeln('Массив X:');
for i:=1 to m do
begin
x[i]:=random(10);
write(x[i]:4);
end;
writeln;
writeln('Массив A:');
for i:=1 to m do
begin
for j:=1 to k do
begin
a[i,j]:=(abs(j-3)-1.3)*(2*x[i]+0.5);
write(a[i,j]:7:2);
end;
writeln;
end;
end.
Пример:
Массив X:
8 6 5 3
Массив A:
11.55 -4.95 -21.45 -4.95 11.55
8.75 -3.75 -16.25 -3.75 8.75
7.35 -3.15 -13.65 -3.15 7.35
4.55 -1.95 -8.45 -1.95 4.55