Program task1;
const n = 30;
var a :array [1..n] of integer;
i, p :integer;
pr :real;
begin
randomize;
for i:= 1 to n do
a[i]:= random(33)-7;
p:= 1; for i:= 1 to n do
if a[i] > 0 then
p:= p * a[i];
pr:= p/2;
writeln(pr);
end.
program task2;
const n = 30;
var a: array [1..n] of integer;
i, sum, max, min: integer;
sr: real;
begin
randomize;
for i := 1 to n do
a[i] := random(33) - 7;
sum:= 0;
for i := 1 to n do
if a[i] >= 0 then
sum:= sum + sqr(a[i]);
min:= a[1]; max:= a[1];
for i := 1 to n do begin
if a[i] > max then max:= a[i];
if a[i] < min then min:= a[i];
end;
sr:= (max + min)/2;
writeln('Сумма кадратов: ',sum);
writeln('Среднее арифметическое: ',sr);
end.