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

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

for(i=0;i<5;i++)

scanf("%d",&a[i]);
for(i=0;i<5;i++)
{
if((a[i]%2 ==0))
count_even++;
if((a[i]%2==1))
count_odd++;
}
cout<<"Even:"<<count_even<<"\n"<<"Odd:"<<count_odd;
getch();
}

Is This Answer Correct ?    8 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a stream?

1078


Explain logical errors? Compare with syntax errors.

1011


What is the total generic pointer type?

1109


What is the advantage of using #define to declare a constant?

1037


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

1000


Once I have used freopen, how can I get the original stdout (or stdin) back?

1030


what will be maximum number of comparisons when number of elements are given?

1849


How many main () function we can have in a project?

1064


Do array subscripts always start with zero?

1236


What is sizeof array?

1001


How to set file pointer to beginning c?

1145


Does sprintf put null character?

987


What is a structure and why it is used?

1135


Can a variable be both static and volatile in c?

974


main() { printf("hello"); fork(); }

1147