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
Is fortran still used today?
What is the use of define in c?
How can you draw circles in C?
Explain the use of fflush() function?
Is using exit() the same as using return?
Explain what does a function declared as pascal do differently?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
Define recursion in c.
Why is void main used?
What does the message "automatic aggregate intialization is an ansi feature" mean?
What is the difference between pure virtual function and virtual function?
Mention four important string handling functions in c languages .
What is the use of structure padding in c?
What is use of #include in c?
What is the difference between formatted&unformatted i/o functions?