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

Is it possible to have a function as a parameter in another function?

603


What is the best way to store flag values in a program?

583


develop algorithms to add polynomials (i) in one variable

1747


we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?

804


general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

590






Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

587


Explain the red-black trees?

611


What's the best way of making my program efficient?

629


Explain what is a 'locale'?

587


Is array name a pointer?

608


What is a null pointer in c?

600


What is adt in c programming?

613


Do pointers store the address of value or the actual value of a variable?

613


Are the variables argc and argv are local to main?

793


What is structure in c explain with example?

642