write a program to find the number of even integers and odd
integers in a given array in c language

Answer Posted / anup majhi

#include<stdio.h>
#include<conio.h>
#define size 100
void check(int[],int);
int i;
main(){
int a[size],m
printf("Enter the array length ");
scanf("%d",&m);
printf("Supply elements to the array ");
for(i=0;i<m;i++)
scanf("%d",&a[i]);
check(a,m);
}
void check(int a[],int b){
int even=0,odd=0;
for(i=0;i<b;i++){
if(a[i]%2==0)
even++;
else
odd++;
}
printf("Number of even no. in the array =%d ",even);
printf("\nNumber of odd no. in the array =%d ",odd);
}


out put:
Enter the array length 5
Supply array elements 1 2 3 4 5
Number of even no. in the array =2
Number of odd no. in the array =3

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain #pragma statements.

785


How can I direct output to the printer?

1041


What is the use of a conditional inclusion statement in C?

804


How many identifiers are there in c?

749


What are the advantages and disadvantages of a heap?

883






What does the c preprocessor do?

827


Why doesnt that code work?

766


How do I use strcmp?

817


why wipro wase

2022


What is the use of define in c?

778


Write a program for Overriding.

887


How can you tell whether two strings are the same?

1015


What is a stream water?

876


How do you use a 'Local Block'?

903


What are types of functions?

739