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 / merlin

#include<studio.h>
#include<conio.h>
void main()
{
int a[20],even=0,odd=0,i,n;
printf("Enter the size of the array");
scanf("%d",&n);
printf("Enter the elements");
for(i=0;i<n;i++)
{

scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{

if((a[i]%2 ==0))
even++;
else
odd++;
}
printf("%d %d",even,odd);
getch();
}

Is This Answer Correct ?    15 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the difference between a free-standing and a hosted environment?

1189


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

1101


Can we declare function inside main?

1009


What is a #include preprocessor?

1163


Explain how can I read and write comma-delimited text?

1177


What are external variables in c?

1111


What is const and volatile in c?

1051


what are enumerations in C

1164


What is main function in c?

1087


What is the meaning of && in c?

1026


Explain what does the format %10.2 mean when included in a printf statement?

1367


Can we change the value of #define in c?

1001


What are nested functions in c?

1032


How can I read and write comma-delimited text?

1077


Can we change the value of constant variable in c?

1064