题目描述
编写程序,读入未指定个数的整数,判定读入的正数有多少个,读入的负数有多少个,然后计算这些输入值的总和及其平均值(不对0计算)当输入为0时,表明程序结束。将平均值以浮点数显示(小数点后保留2位四舍五入)。
输入格式
输入若干个整数
输出格式
<p> 输出: </p> <p> <p class="MsoNormal"> The number of positives is 正数个数 </p> <p class="MsoNormal"> The number of negatives is 负数个数 </p> <p class="MsoNormal"> The total is 数的总和 </p> <p class="MsoNormal"> The average is 数的平均数 </p> </p>
样例
样例输入 1
1 2 -1 3 0
样例输出 1
The number of positives is 3
The number of negatives is 1
The total is 5
The average is 1.25
提交代码
请先登录后提交
🤖 AI 解题助手
OpenRouter
就绪