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
Is it possible to have a function as a parameter in another function?
What is the best way to store flag values in a program?
develop algorithms to add polynomials (i) in one variable
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 ?
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
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
Explain the red-black trees?
What's the best way of making my program efficient?
Explain what is a 'locale'?
Is array name a pointer?
What is a null pointer in c?
What is adt in c programming?
Do pointers store the address of value or the actual value of a variable?
Are the variables argc and argv are local to main?
What is structure in c explain with example?