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
What does a pointer variable always consist of?
What is extern c used for?
What is the function of this pointer?
What is malloc() function?
How are variables declared in c?
Why is c still so popular?
Which is the memory area not included in C program? give the reason
Explain what are the advantages and disadvantages of a heap?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
What is the size of enum in c?
Why is not a pointer null after calling free?
Explain 'far' and 'near' pointers in c.
How can I do peek and poke in c?
What is the difference between #include
What is data structure in c programming?