Quảng cáo
1 câu trả lời 163
program CountPositiveNegative;
var
n, countPositive, countNegative: integer;
num: real;
begin
countPositive := 0;
countNegative := 0;
write('Enter the number of elements in the list: ');
readln(n);
for i := 1 to n do begin
write('Enter a number: ');
readln(num);
if num > 0 then
countPositive := countPositive + 1
else if num < 0 then
countNegative := countNegative + 1;
end;
writeln(countPositive, ' positive numbers');
writeln(countNegative, ' negative numbers');
readln;
end.
Quảng cáo
Bạn cần hỏi gì?
Câu hỏi hot cùng chủ đề
-
Đã trả lời bởi chuyên gia
86376
Gửi báo cáo thành công!
