write a program to find the number of even integers and odd
integers in a given array in c language
Answer Posted / merlin
#include<studio.h>
#include<conio.h>
void main()
{
int a[20],even=0,odd=0,i,n;
printf("Enter the size of the array");
scanf("%d",&n);
printf("Enter the elements");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if((a[i]%2 ==0))
even++;
else
odd++;
}
printf("%d %d",even,odd);
getch();
}
Is This Answer Correct ? | 15 Yes | 19 No |
Post New Answer View All Answers
What is the difference between the = symbol and == symbol?
What is the explanation for the dangling pointer in c?
What is break in c?
what is the height of tree if leaf node is at level 3. please explain
What is the benefit of using const for declaring constants?
What does calloc stand for?
What are the 5 elements of structure?
How can I split up a string into whitespace-separated fields?
Can include files be nested?
What is the difference between declaring a variable and defining a variable?
Explain the ternary tree?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
How is a structure member accessed?
Is main is a keyword in c?
What do you mean by a sequential access file?