uses Crt; const n=50; type Vec=array [1..n] of integer; var A: Vec; i, Sum, Col: integer; begin ClrScr; Randomize; Sum:=0; Col:=0; for i:=1 to n do begin A[i]:=10+random(40); Write(A[i]: 4); if (i mod 10 =0 ) then WriteLn; if (A[i] mod 7 = 1) or (A[i] mod 7 = 2) or (A[i] mod 7 = 5 ) then begin Sum:=Sum+A[i]; Col:=Col+1; end; end; WriteLn; WriteLn (' Sum = ', Sum); WriteLn (' Col = ', Col); ReadLn; end.
Const n=5;m=7; var a:array[1..n,1..m]of integer; b:array[1..n*m]of integer; i,j,buf,k:integer; begin for i:=1 to n do begin for j:=1 to m do begin a[i,j]:=random(100); write(a[i,j]:4); k:=k+1; b[k]:=a[i,j]; end; writeln; end; writeln; for i:=1 to n*m-1 do for j:=i+1 to n*m do if b[i]>b[j] then begin buf:=b[i]; b[i]:=b[j]; b[j]:=buf; end; for i:=1 to m*n do write(b[i]:4); end.
uses Crt;
const n=50;
type Vec=array [1..n] of integer;
var A: Vec;
i, Sum, Col: integer;
begin
ClrScr;
Randomize;
Sum:=0;
Col:=0;
for i:=1 to n do
begin
A[i]:=10+random(40);
Write(A[i]: 4);
if (i mod 10 =0 ) then WriteLn;
if (A[i] mod 7 = 1) or (A[i] mod 7 = 2) or (A[i] mod 7 = 5 ) then
begin
Sum:=Sum+A[i];
Col:=Col+1;
end;
end;
WriteLn;
WriteLn (' Sum = ', Sum);
WriteLn (' Col = ', Col);
ReadLn;
end.
n=5;m=7;
var
a:array[1..n,1..m]of integer;
b:array[1..n*m]of integer;
i,j,buf,k:integer;
begin
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(100);
write(a[i,j]:4);
k:=k+1;
b[k]:=a[i,j];
end;
writeln;
end;
writeln;
for i:=1 to n*m-1 do
for j:=i+1 to n*m do
if b[i]>b[j] then
begin
buf:=b[i];
b[i]:=b[j];
b[j]:=buf;
end;
for i:=1 to m*n do
write(b[i]:4);
end.