Program z567;
Var a: array [1..30] of integer;
b: array [1..20] of integer;
i,max,p,min:integer; s:real;
Begin
for i:=1 to 30 do
a[i]:=random(10)-5;
for i:=1 to 20 do
b[i]:=random(10);
write(a[i],' ');
p:=1;
if (a[i] > 0) then p:=p*a[i];
writeln('');
writeln('1-ое задание: ', p);
write(b[i],' ');
max:=b[1];
for i:=2 to 19 do
if (b[i] > max) then max:=b[i];
min:=b[1];
if (b[i] < min) then min:=b[i];
s:=(min+max)/2;
writeln('2-ое задание: ', s);
End.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Program z567;
Var a: array [1..30] of integer;
b: array [1..20] of integer;
i,max,p,min:integer; s:real;
Begin
for i:=1 to 30 do
a[i]:=random(10)-5;
for i:=1 to 20 do
b[i]:=random(10);
for i:=1 to 30 do
write(a[i],' ');
p:=1;
for i:=1 to 30 do
if (a[i] > 0) then p:=p*a[i];
writeln('');
writeln('1-ое задание: ', p);
for i:=1 to 20 do
write(b[i],' ');
max:=b[1];
for i:=2 to 19 do
if (b[i] > max) then max:=b[i];
min:=b[1];
for i:=2 to 19 do
if (b[i] < min) then min:=b[i];
s:=(min+max)/2;
writeln('');
writeln('2-ое задание: ', s);
End.