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
Explain what is the difference between a free-standing and a hosted environment?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
Can we declare function inside main?
What is a #include preprocessor?
Explain how can I read and write comma-delimited text?
What are external variables in c?
What is const and volatile in c?
what are enumerations in C
What is main function in c?
What is the meaning of && in c?
Explain what does the format %10.2 mean when included in a printf statement?
Can we change the value of #define in c?
What are nested functions in c?
How can I read and write comma-delimited text?
Can we change the value of constant variable in c?