program CountNumbers;
varN, number, positive, negative, zero : integer;i : integer;
beginpositive := 0;negative := 0;zero := 0;
write('Enter the number of integers: ');readln(N);
for i := 1 to N dobeginwrite('Enter ', i, ' integer: ');readln(number);
end;
writeln('Number of positive integers: ', positive);writeln('Number of negative integers: ', negative);writeln('Number of zeros: ', zero);end.
{ Test 1 }// Input: N = 5, numbers = {3, -5, 0, 12, -7}// Expected output: Positive = 2, Negative = 2, Zero = 1
{ Test 2 }// Input: N = 3, numbers = {-1, -4, -2}// Expected output: Positive = 0, Negative = 3, Zero = 0
program CountNumbers;
var
N, number, positive, negative, zero : integer;
i : integer;
begin
positive := 0;
negative := 0;
zero := 0;
write('Enter the number of integers: ');
readln(N);
for i := 1 to N do
if number > 0 thenbegin
write('Enter ', i, ' integer: ');
readln(number);
positive := positive + 1
else if number < 0 then
negative := negative + 1
else
zero := zero + 1;
end;
writeln('Number of positive integers: ', positive);
writeln('Number of negative integers: ', negative);
writeln('Number of zeros: ', zero);
end.
{ Test 1 }
// Input: N = 5, numbers = {3, -5, 0, 12, -7}
// Expected output: Positive = 2, Negative = 2, Zero = 1
{ Test 2 }
// Input: N = 3, numbers = {-1, -4, -2}
// Expected output: Positive = 0, Negative = 3, Zero = 0