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

Answer Posted / ankit kumar sharma

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],count_even=0,count_odd=0,i;

printf("Enter the value in Array\n");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
/* Calculating number of odd and even intergers */
for(i=0;i<5;i++)
{
if((a[i]%2 ==0))
count_even++;
if((a[i]%2==1))
count_odd++;
}
/* display the number of odd and even intergers */
printf(" Total number of even integer are %d\n ",count_even);
printf("Total number of odd integer are %d", count_odd);
getch();
}

Is This Answer Correct ?    13 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are external variables in c?

549


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

669


What does %p mean?

598


What are the 5 organizational structures?

571


What is the c value paradox and how is it explained?

578






write a c program to find the sum of five entered numbers using an array named number

1621


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


What is a keyword?

749


What is dynamic memory allocation?

812


Are c and c++ the same?

629


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

3735


How can I find the modification date and time of a file?

606


What does 4d mean in c?

951


What does int main () mean?

554


What is a static function in c?

624