ввести с клавиатуры 10 чисел и найти сумму неотрицательных из них и произведение отрицательных
Program SumAndMul;
Uses Crt;
var a:array[1..10] of real;
i:integer;
sum,mul:longint;
begin
clrscr;
for i:=1 to 10 do
begin
write(Введите -, i, число: );
readln(a[i]);
end;
sum:=0;mul:=1;
for i:=1 to 10 do
begin
if (a[i]>0) then sum:=sum+a[i];
if (a[i]<0 ) then mul:=mul*a[i];
end;
writeln(Сумма положительных элементов: ,sum);
writeln(Произведение отрицательных элементов: ,mul);
readkey;
end.
Оцени ответ
