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

What is Dynamic memory allocation in C? Name the dynamic allocation functions.

562


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2309


Which built-in library function can be used to match a patter from the string?

751


Why is event driven programming or procedural programming, better within specific scenario?

1955


write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.

14973






Can we change the value of constant variable in c?

580


What does printf does?

753


Where are local variables stored in c?

576


write a program to find the given number is prime or not

3850


Can you please explain the scope of static variables?

608


write a progrmm in c language take user interface generate table using for loop?

1576


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1676


How can I write a function analogous to scanf?

662


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1500


Explain what are linked list?

628