#include<stdio.h> int main(){ int i, a, sum=0, count=0; for(i=1; i<=10; ++i){ scanf("%d",&a); if(a%2){ sum+=a; count++; } } printf("sum=%d, count=%d\n", sum, count); return 0; }
第3个回答 2011-05-23
#include<stdio.h> void main() { int i,n=0,sum=0; int a[10]; printf("enter ten numbers:\n"); for(i=0;i<10;i++) scanf("%d",&a[i]); for(i=0;i<10;i++) { if(a[i]/2 != 0) { n++; sum+=a[i]; } } printf("THE NUMBER OF ODD IS %d,THE SUM IS %d \n",n,sum); }