1. uses crt; const n=20; var i,cp1,cn1:integer; p,cp,cn:real; z:array[1..n] of integer; begin randomize; for i:=1 to n do begin z[i]:=random(20,-20); if z[i]>=0 then begin cp:=cp+z[i]; cp1:=cp1+1; end else begin cn:=cp+z[i]; cn1:=cn1+1; end; cp:=cp/cp1; cn:=cn/cn1; end; if cp>cn then p:=cp+cn else p:=cp*cn; for i:=1 to n do write(z[i],' '); writeln(#13#10,cp:5:2,' ',cn:5:2,' ',p:5:2); end. 2. uses crt; const n=15;m=4; var i,j,k,flag,count:integer; a:array[1..n,1..m] of integer; temp:array[1..100] of integer; b:array[1..100,1..m] of integer; begin randomize; k:=1; count:=0; for i:=1 to n do begin flag:=1; for j:=1 to m do begin a[i,j]:=random(51,1); if (a[i,j]<10) or (a[i,j]>40) then flag:=0 end; if flag=1 then begin temp[k]:=i; count:=count+1; k:=k+1; end; end; for i:=1 to count do for j:=1 to m do b[i,j]:=a[temp[i],j]; writeln('Массив A:'); for i:=1 to n do begin for j:=1 to m do write(a[i,j],' '); write(#13#10); end; if count=0 then writeln('Нет подходящих строк.') else begin writeln(#13#10,'Массив B:'); for i:=1 to count do begin for j:=1 to m do write(b[i,j],' '); write(#13#10); end; end; end.
Program project1; uses crt,math; var s:real; i,j,f:real; a:integer; begin writeln('vvedite 1 chislo ');readln(i); writeln('vvedite 2 chislo ');readln(j); writeln('vvedite 3 chislo ');readln(f); s:=i; if j<s then s:=j; if f<s then s:=f; if s<0 then begin if i<0 then inc(a); if j<0 then inc(a); if f<0 then inc(a); writeln('kolichestvo otricatelnix ',a:2); end else begin if i>0 then i:=i*-1; if j>0 then j:=i*-1; if f>0 then f:=i*-1; end; writeln('min chislo ',s:2:0); readln; end.
uses crt;
const n=20;
var i,cp1,cn1:integer;
p,cp,cn:real;
z:array[1..n] of integer;
begin
randomize;
for i:=1 to n do
begin
z[i]:=random(20,-20);
if z[i]>=0 then
begin
cp:=cp+z[i];
cp1:=cp1+1;
end
else
begin
cn:=cp+z[i];
cn1:=cn1+1;
end;
cp:=cp/cp1;
cn:=cn/cn1;
end;
if cp>cn then
p:=cp+cn
else
p:=cp*cn;
for i:=1 to n do
write(z[i],' ');
writeln(#13#10,cp:5:2,' ',cn:5:2,' ',p:5:2);
end.
2.
uses crt;
const n=15;m=4;
var i,j,k,flag,count:integer;
a:array[1..n,1..m] of integer;
temp:array[1..100] of integer;
b:array[1..100,1..m] of integer;
begin
randomize;
k:=1;
count:=0;
for i:=1 to n do
begin
flag:=1;
for j:=1 to m do
begin
a[i,j]:=random(51,1);
if (a[i,j]<10) or (a[i,j]>40) then
flag:=0
end;
if flag=1 then
begin
temp[k]:=i;
count:=count+1;
k:=k+1;
end;
end;
for i:=1 to count do
for j:=1 to m do
b[i,j]:=a[temp[i],j];
writeln('Массив A:');
for i:=1 to n do
begin
for j:=1 to m do
write(a[i,j],' ');
write(#13#10);
end;
if count=0 then
writeln('Нет подходящих строк.')
else
begin
writeln(#13#10,'Массив B:');
for i:=1 to count do
begin
for j:=1 to m do
write(b[i,j],' ');
write(#13#10);
end;
end;
end.
uses
crt,math;
var s:real; i,j,f:real; a:integer;
begin
writeln('vvedite 1 chislo ');readln(i);
writeln('vvedite 2 chislo ');readln(j);
writeln('vvedite 3 chislo ');readln(f);
s:=i;
if j<s then s:=j;
if f<s then s:=f;
if s<0 then
begin
if i<0 then inc(a);
if j<0 then inc(a);
if f<0 then inc(a);
writeln('kolichestvo otricatelnix ',a:2);
end
else
begin
if i>0 then i:=i*-1;
if j>0 then j:=i*-1;
if f>0 then f:=i*-1;
end;
writeln('min chislo ',s:2:0);
readln;
end.