/* write a program that reads a sequence of positive integers first negative or zero terminates the input the program finds the number of iputs, sum and ave, and counts the number of evens and number of odds */ #include int main(){ int count=0,sum=0,num,count_even=0, count_odd=0; printf("enter a sequence of positive integers\n"); scanf("%d",&num); while(num>0){ sum+=num; count++; if(num%2==0) count_even++; else count_odd++; scanf("%d",&num); } if(count>0){ printf("sum=%d,count=%d,ave=%f\n",sum,count,(float)(sum)/count); if(count_even>0) printf("%d evens\n",count_even); else printf("no evens\n"); if(count_odd>0) printf("%d odds\n",count_odd); else printf("no odds\n"); } else printf("no positive inputs\n"); return 0; }