Выполнить в Pascal "Обработка двумерных массивов в программе на Pascal"
Answers & Comments
FaikYB
Номер 1 program z1; var i, j, temp: integer; ar:array [1..5] of array [1..5] of integer; begin for i:=1 to 5 do begin temp:=-10; for j:=1 to 5 do begin ar[i, j]:=temp; inc(temp, 2); end; end; for i:=1 to 5 do begin for j:=1 to 4 do begin write(ar[i,j], ' '); end; writeln(ar[i,5]); end; end.
Номер 3 program z3; var ar: array [1..5] of array [1..3] of integer; ar1: array [1..5] of shortint; i, j: integer; begin for i:=1 to 5 do begin for j:=1 to 2 do read(ar[i, j]); readln(ar[i, 3]); end; for i:=1 to 5 do begin for j:=1 to 3 do begin if odd(ar[i, j]) then inc(ar1[i]); end; end; for i:=1 to 5 do write(ar1[i], ' '); end.
Answers & Comments
program z1;
var i, j, temp: integer;
ar:array [1..5] of array [1..5] of integer;
begin
for i:=1 to 5 do begin
temp:=-10;
for j:=1 to 5 do begin
ar[i, j]:=temp;
inc(temp, 2);
end;
end;
for i:=1 to 5 do begin
for j:=1 to 4 do begin
write(ar[i,j], ' ');
end;
writeln(ar[i,5]);
end;
end.
Номер 3
program z3;
var ar: array [1..5] of array [1..3] of integer;
ar1: array [1..5] of shortint;
i, j: integer;
begin
for i:=1 to 5 do begin
for j:=1 to 2 do read(ar[i, j]);
readln(ar[i, 3]);
end;
for i:=1 to 5 do begin
for j:=1 to 3 do begin
if odd(ar[i, j]) then inc(ar1[i]);
end;
end;
for i:=1 to 5 do write(ar1[i], ' ');
end.