c program to find number of even and odd number
c program to find number of even and odd number
if you want to find number of even and odd number entered by user then please go through the given below program.
#include<stdio.h>
#include<string.h>
int main(){
int a[20],i,n,e=0;
printf("enter the size of array\n");
scanf("%d",&n);
printf("enter the %d elements of array\n",n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
switch(a[i]%2){
case 0: e++; break;
}
}
printf("number of even %d\n",e);
printf("number of odd %d\n",n-e);
Comments
Post a Comment