program raf105;
const
n = 4;
var
a,b: array[1..n,1..n] of integer;
Vkol1,Vkol2,Vsum1,Vsum2: array[1..n] of integer;
i,j,sum1,sum2,kol1,kol2: integer;
x1,x2: boolean;
begin
for i:=1 to n do
x1:= False;
x2:= False;
kol1:= 0;
kol2:= 0;
sum1:= 0;
sum2:= 0;
for j:=1 to n do
a[i,j]:= random(-9,9);
b[i,j]:= random(-9,9);
if a[i,j] < 0
then x1:= True;
if b[i,j] < 0
then x2:= True;
if not(x1)
then begin
sum1:= sum1 + a[i,j];
kol1:= kol1 + 1;
end;
if not(x2)
sum2:= sum2 + b[i,j];
kol2:= kol2 + 1;
Vkol1[i]:= kol1;
Vkol2[i]:= kol2;
Vsum1[i]:= sum1;
Vsum2[i]:= sum2;
writeln('Массив A');
writeln;
write(a[i,j]:3);
writeln('Массив B');
write(b[i,j]:3);
write('Вектор "Количество по строкам A": ');
write(Vkol1[i],' ');
write('Вектор "Количество по строкам B": ');
write(Vkol2[i],' ');
write('Вектор "Сумма по строкам A": ');
write(Vsum1[i],' ');
write('Вектор "Сумма по строкам B": ');
write(Vsum2[i],' ');
end.
program raf105;
const
n = 4;
var
a,b: array[1..n,1..n] of integer;
Vkol1,Vkol2,Vsum1,Vsum2: array[1..n] of integer;
i,j,sum1,sum2,kol1,kol2: integer;
x1,x2: boolean;
begin
for i:=1 to n do
begin
x1:= False;
x2:= False;
kol1:= 0;
kol2:= 0;
sum1:= 0;
sum2:= 0;
for j:=1 to n do
begin
a[i,j]:= random(-9,9);
b[i,j]:= random(-9,9);
if a[i,j] < 0
then x1:= True;
if b[i,j] < 0
then x2:= True;
if not(x1)
then begin
sum1:= sum1 + a[i,j];
kol1:= kol1 + 1;
end;
if not(x2)
then begin
sum2:= sum2 + b[i,j];
kol2:= kol2 + 1;
end;
end;
Vkol1[i]:= kol1;
Vkol2[i]:= kol2;
Vsum1[i]:= sum1;
Vsum2[i]:= sum2;
end;
writeln('Массив A');
for i:=1 to n do
begin
writeln;
for j:=1 to n do
write(a[i,j]:3);
end;
writeln;
writeln;
writeln('Массив B');
for i:=1 to n do
begin
writeln;
for j:=1 to n do
write(b[i,j]:3);
end;
writeln;
writeln;
write('Вектор "Количество по строкам A": ');
for i:=1 to n do
write(Vkol1[i],' ');
writeln;
write('Вектор "Количество по строкам B": ');
for i:=1 to n do
write(Vkol2[i],' ');
writeln;
write('Вектор "Сумма по строкам A": ');
for i:=1 to n do
write(Vsum1[i],' ');
writeln;
write('Вектор "Сумма по строкам B": ');
for i:=1 to n do
write(Vsum2[i],' ');
end.
PascalABC 3.4.2