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


Please Help Members By Posting Answers For Below Questions

What is the difference between the = symbol and == symbol?

793


What is the explanation for the dangling pointer in c?

872


What is break in c?

780


what is the height of tree if leaf node is at level 3. please explain

1809


What is the benefit of using const for declaring constants?

776






What does calloc stand for?

827


What are the 5 elements of structure?

791


How can I split up a string into whitespace-separated fields?

780


Can include files be nested?

814


What is the difference between declaring a variable and defining a variable?

921


Explain the ternary tree?

777


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

2000


How is a structure member accessed?

789


Is main is a keyword in c?

823


What do you mean by a sequential access file?

792