Задача в паскале среди 10 введенных с клавиатуры чисел подсчитать количество отрицательных и произведение положительных чисел рассмотреть случай когда положительных чисел нет
var number, negatives, positives, product: integer; i: integer;
begin negatives := 0; positives := 0; product := 1;
for i := 1 to 10 do begin writeln('Enter a number: '); readln(number);
if number < 0 then negatives := negatives + 1 else if number > 0 then begin positives := positives + 1; product := product * number; end;
end;
writeln('Number of negative numbers: ', negatives); if positives > 0 then writeln('Product of positive numbers: ', product) else writeln('There are no positive numbers to calculate the product.'); end.
program CountNegativesAndMultiplyPositives;
var
number, negatives, positives, product: integer;
i: integer;
begin
negatives := 0;
positives := 0;
product := 1;
for i := 1 to 10 do
if number < 0 thenbegin
writeln('Enter a number: ');
readln(number);
negatives := negatives + 1
else if number > 0 then
begin
positives := positives + 1;
product := product * number;
end;
end;
writeln('Number of negative numbers: ', negatives);
if positives > 0 then
writeln('Product of positive numbers: ', product)
else
writeln('There are no positive numbers to calculate the product.');
end.