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
Explain how can I convert a number to a string?
What is the purpose of sprintf?
Sir i need notes for structure,functions,pointers in c language can you help me please
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
What does p mean in physics?
What is the hardest programming language?
how logic is used
What is the translation phases used in c language?
Is null valid for pointers to functions?
What do you know about the use of bit field?
A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?
Write a c program to demonstrate character and string constants?
What is meant by gets in c?
What are the features of the c language?
Why do we need functions in c?