Count number of Odd and Even numbers in the given array in C

This program helps you to find the number of even and odd numbers present in the given array

Source code :


#include<stdio.h>


int main(){
    
int odd=0,even=0,i;

int numbers[10] = {7,10,4,13,8,5,10,25,88,14}; //Change the numbers here

for(i=0; i < 10 ;i++){
    
    
	if( numbers[i] %2 == 0){
	    ++even;
	}else{
	    ++odd;
	}
	
}

    printf("There are %d even numbers in the give array",even);
    printf("\nThere are %d odd numbers in the give array",odd);
    
return 0;
}


Output :

There are 6 even numbers in the give array
There are 4 odd numbers in the give array

Output :


                

Comments :