Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Why are all header files not declared in every c program?

1095


Why is c called c?

1010


What are integer variable, floating-point variable and character variable?

1237


What is floating point constants?

1118


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

2168


Differentiate between a for loop and a while loop? What are it uses?

1168


What are the different types of errors?

1129


How macro execution is faster than function ?

1177


What will be your course of action for a push operation?

1108


What is the correct declaration of main?

1205


What are the various types of control structures in programming?

1053


why we wont use '&' sing in aceesing the string using scanf

2363


cavium networks written test pattern ..

4074


What is #define size in c?

1183


What is nested structure with example?

1065