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
Can we assign integer value to char in c?
What is the difference between variable declaration and variable definition in c?
What is the use of define in c?
What is data structure in c and its types?
Can include files be nested?
What are structures and unions? State differencves between them.
Explain what does a function declared as pascal do differently?
What is the use of getchar functions?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
Define and explain about ! Operator?
What is structure pointer in c?
What are enumerated types?
What is the symbol indicated the c-preprocessor?
What is the heap?
What library is sizeof in c?