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 void main ()?
How can I recover the file name given an open stream?
Define macros.
What are the types of pointers?
What is the difference between #include
What are the advantages of using Unions?
Explain spaghetti programming?
Which is better pointer or array?
What are the complete rules for header file searching?
What is meant by int main ()?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
What is the auto keyword good for?
What is omp_num_threads?
What is d scanf?