angala
1
/*
Program#110
Mean of Positive, Negative Nos
*/
#include <stdio.h>
main(){
int n;
int p_sum,ne_sum;
float p_mean,ne_mean;
int p,ne=0;
p=ne=p_sum=ne_sum=0;
for(scanf("%d",&n);n!=-1000;scanf("%d",&n)){
if(n>0){
p_sum+=n;
p++;
}
else
if(n<0){
ne_sum+=n;
ne++;
}
}
p_mean=(float)p_sum/(float)p; //Make sure type casting is done
ne_mean=(float)ne_sum/(float)ne;
printf("\n Positive sum: %d \n Negative Sum : %d",p_sum,ne_sum);
printf("\n Mean Potive = %f Negative %f",p_mean,ne_mean);
}