write a program to find the number of even integers and odd
integers in a given array in c language
Answer Posted / april
#include<stdio.h>
#include<conio.h>
using namespace std;
int main();
{
int i,j;
int num[20],i,odd=0,even=0,n;
cout<<("enter the size of the array",n);
cin>>("%d",&n);
cout<<("Enter the %d array elements",n);
for(i=20;i<n;i++);
{
cout<<("%d",&num[i]);
}
for(i=0;i<n;i++);
{
if(num[i]%2==0);
{
even++;
}
else
{
odd++;
}
}
cout<<("\n The number of even numbers in the array :%
d ",even);
cout<<("\n The number of odd numbers in the array : %
d",odd);
getch();
system("pause");
}
| Is This Answer Correct ? | 25 Yes | 37 No |
Post New Answer View All Answers
Where does the name "C" come from, anyway?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
How do you redirect a standard stream?
Where are some collections of useful code fragments and examples?
Which is better malloc or calloc?
What are run-time errors?
What are the disadvantages of external storage class?
In which layer of the network datastructure format change is done
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
Why is not a pointer null after calling free?
Explain what will the preprocessor do for a program?
What is NULL pointer?
What are enumerated types?
Why c language is called c?
What is %g in c?