Uses Crt; const n=5; m=7; type Mas = array [1..n, 1..m] of integer; var i, j, j1, j2: integer; Sumj1, Sumj2: real; A: Mas; begin ClrScr; Randomize; SumJ1:=0; SumJ2:=0; for i:=1 to n do for j:=1 to m do A[i,j]:=random (10); WriteLn (' Massiv A: '); for i:=1 to n do begin for j:=1 to m do Write (A[i,j]:4); WriteLn; end; WriteLn; repeat Write (' Stolbez #1 = '); ReadLn(j1); until (j1>=1) and (j1<=m); repeat Write (' Stolbez #2 = '); ReadLn(j2); until (j2>=1) and (j2<=m) and (j1<>j2); for i:= 1 to n do SumJ1 := SumJ1+A[i,j1]; for i:= 1 to n do SumJ2:=SumJ2+A[i,j2]; SumJ1:=SumJ1/n; SumJ2:=SumJ2/n; WriteLn; WriteLn (' Srednee stolbza ', j1, ' = ', SumJ1:4:2); WriteLn (' Srednee stolbza ', j2, ' = ', SumJ2:4:2); ReadLn; end.
var a: array[1..n] of real; i, j: integer; min, max: real; sum, product, harmonic: real;
begin {ввод массива} writeln('Данные массива:'); for i := 1 to n do begin a[i] := random(40) - 20; write(a[i], ' '); end; writeln();
{подсчет суммы и произведения и агригатов} sum := 0; for i := 1 to n do sum := sum + a[i]; writeln('average = ', sum / n);
{минимум и максимум} min := a[1]; for i := 1 to n do if min > a[i] then min := a[i]; writeln('min = ', min);
{подсчет суммы и произведения и агригатов} sum := 0; for i := 1 to n do if i mod 2 = 0 then {если нужен фильтр} sum := sum + a[i]; writeln('sum = ', sum); end.
const n=5; m=7;
type Mas = array [1..n, 1..m] of integer;
var i, j, j1, j2: integer;
Sumj1, Sumj2: real;
A: Mas;
begin
ClrScr;
Randomize;
SumJ1:=0; SumJ2:=0;
for i:=1 to n do
for j:=1 to m do
A[i,j]:=random (10);
WriteLn (' Massiv A: ');
for i:=1 to n do
begin
for j:=1 to m do
Write (A[i,j]:4);
WriteLn;
end; WriteLn;
repeat
Write (' Stolbez #1 = '); ReadLn(j1);
until (j1>=1) and (j1<=m);
repeat
Write (' Stolbez #2 = '); ReadLn(j2);
until (j2>=1) and (j2<=m) and (j1<>j2);
for i:= 1 to n do
SumJ1 := SumJ1+A[i,j1];
for i:= 1 to n do
SumJ2:=SumJ2+A[i,j2];
SumJ1:=SumJ1/n; SumJ2:=SumJ2/n;
WriteLn;
WriteLn (' Srednee stolbza ', j1, ' = ', SumJ1:4:2);
WriteLn (' Srednee stolbza ', j2, ' = ', SumJ2:4:2);
ReadLn;
end.
n = 25;
var
a: array[1..n] of real;
i, j: integer;
min, max: real;
sum, product, harmonic: real;
begin
{ввод массива}
writeln('Данные массива:');
for i := 1 to n do
begin
a[i] := random(40) - 20;
write(a[i], ' ');
end;
writeln();
{подсчет суммы и произведения и агригатов}
sum := 0;
for i := 1 to n do
sum := sum + a[i];
writeln('average = ', sum / n);
{минимум и максимум}
min := a[1];
for i := 1 to n do
if min > a[i] then min := a[i];
writeln('min = ', min);
{подсчет суммы и произведения и агригатов}
sum := 0;
for i := 1 to n do
if i mod 2 = 0 then {если нужен фильтр}
sum := sum + a[i];
writeln('sum = ', sum);
end.