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 the types of bitwise operator?

667


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

752


What is meant by high-order and low-order bytes?

660


What does 2n 4c mean?

728


Is there a built-in function in C that can be used for sorting data?

749






Which header file is essential for using strcmp function?

947


How do you search data in a data file using random access method?

842


#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }

724


What are the 4 types of organizational structures?

627


What the different types of arrays in c?

618


What is queue in c?

584


What is the difference between test design and test case design?

1579


What is huge pointer in c?

589


Do character constants represent numerical values?

848


Explain how can I make sure that my program is the only one accessing a file?

635