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 difference between structure and union in c programming?

1039


What is double pointer in c?

994


Explain how can you be sure that a program follows the ansi c standard?

1418


How can a program be made to print the line number where an error occurs?

1045


All technical questions

1936


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

1101


What are the properties of union in c?

1014


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1935


I came across some code that puts a (void) cast before each call to printf. Why?

1166


How will you write a code for accessing the length of an array without assigning it to another variable?

1020


can we change the default calling convention in c if yes than how.........?

2489


What is f'n in math?

1019


What is the difference between array and linked list in c?

1099


What is pass by reference in c?

1154


What is null in c?

1016