#include
int main()
{int i,n,a[100],n1=0,n0=0;
scanf("%d",&n);
for(i=0;i
if(a[i]%2)n1++;
else n0++;
}
if(n1)printf("奇数个数:%d\n",n1);
else printf("没有奇数!\n");
if(n0)printf("偶数个数:%d\n",n0);
else printf("没有偶数!\n");
return 0;
}
#include"stdio.h"
int main(){
int arr[10],i,sum1,sum2;
printf("请输入10个整数:");
for(i=0;i<10;i++){
scanf("%d",&arr[i]);
}
for(i=0;i<10;i++){
if(arr[i]%2==0){
sum1++;
}else{sum2++;}
if(arr[i]<=0){
printf("%d不是偶数也不是奇数",arr[i]);}
}
printf("偶数有:%d个\n",sum1);
printf("奇数有:%d个\n",sum2);
}
return 0;
#include#include#includevoidmain(){inti,js=0,os=0;srand(time(NULL));for(i=0;i<100;i++){if(rand()%2)js++;elseos++;}printf("js=%dos=%d\n",js,os);}