program count_positive_negative;var i, n, positive_count, negative_count: integer;begin positive_count := 0; negative_count := 0; for i := 1 to 20 do begin write('请输入第', i, '个数:'); readln(n); if n > 0 then positive_count := positive_count + 1 else if n < 0 then negative_count := negative_count + 1; end; writeln('正数个数:', positive_count); writeln('负数个数:', negative_count); readln;end.
时间: 2023-05-28 21:06:55 浏览: 82
As an AI language model, I can understand the code you have shared. It is a simple Pascal program that counts the number of positive and negative integers entered by the user. The program uses a for loop to prompt the user to input 20 integers and then check if the integer is positive or negative using if-else statements. The positive and negative counts are stored in the variables positive_count and negative_count respectively. Finally, the program displays the counts of positive and negative integers.
阅读全文