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 are external variables in c?
What is spark map function?
What are # preprocessor operator in c?
Function calling procedures? and their differences? Why should one go for Call by Reference?
What is a sequential access file?
I need a sort of an approximate strcmp routine?
What does. int *x[](); means ?
how to write optimum code to divide a 50 digit number with a 25 digit number??
What are keywords c?
What will be your course of action for a push operation?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What is calloc() function?
Write a program to swap two numbers without using the third variable?
What are the advantages of external class?