#include <stdio.h>
#include <stdlib.h>
int main()
{
int a=0,b=0,c=0;
int i,num;
for(i=0;i<10;i++){
scanf("%d",&num);
if(num>0)
a++;
if(num == 0)
b++;
if(num<0)
c++;
}
printf("整数的个数:%d\n0的个数:%d\n负数的个数:%d\n",a,b,c);
system("pause");
return 0;
}
C语言输入10个整数,统计其中正数、负数和零的个数,并在屏幕上输出
最新推荐文章于 2025-01-06 20:11:24 发布
使用C语言编写程序,从用户输入中读取10个整数,然后计算并输出这些数字中正数、负数和零的计数。程序通过循环结构和条件判断实现对数字类型的分类统计。

8509

被折叠的 条评论
为什么被折叠?



