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 a program flowchart and explain how does it help in writing a program?
What is the function of volatile in c language?
Why is c not oop?
What is floating point constants?
What is a program flowchart?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
What is string concatenation in c?
When was c language developed?
Explain how can I manipulate strings of multibyte characters?
What is the purpose of macro in C language?
What is huge pointer in c?
explain what are actual arguments?
What is #ifdef ? What is its application?
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
How do I get an accurate error status return from system on ms-dos?