C语言版:
#include <stdio.h>
int main(){
printf("Enter 10 numbers: \n");
int positive=0,negative=0,sum=0,zero=0;
int input;
for(int i=1;i<=10;++i){
scanf("%d",&input);
if(input>0){
++positive;
}
else if(input<0){
++negative;
}
else{
++zero;
}
sum+=input;
}
printf("There are %d positive numbers, %d nagetive numbers and %d zeros.\n",positive,negative,zero);
printf("The average number of the 10 numbers is: %f\n",sum/10.0);
}
温馨提示:内容为网友见解,仅供参考