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
What are the different types of data structures in c?
What are categories used for in c?
What is a null pointer in c?
Is it cc or c in a letter?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
What is #line?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
Does free set pointer to null?
What is a function simple definition?
What is the purpose of 'register' keyword?
Is null always equal to 0(zero)?
Explain what is the use of a semicolon (;) at the end of every program statement?
What is the deal on sprintf_s return value?
Differentiate between ordinary variable and pointer in c.
What is nested structure in c?