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
Write a program to swap two numbers without using the third variable?
What are the types of i/o functions?
What does *p++ do? What does it point to?
what is the significance of static storage class specifier?
Why do we use null pointer?
What is the collection of communication lines and routers called?
What is the difference between new and malloc functions?
What is function definition in c?
What is malloc() function?
Is that possible to add pointers to each other?
How can I read data from data files with particular formats?
What are the storage classes in C?
What is array within structure?
What is the use of clrscr?
Calculate 1*2*3*____*n using recursive function??