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 are the preprocessor categories?

641


How #define works?

625


What is a scope resolution operator in c?

756


What is a shell structure examples?

596


What was noalias and what ever happened to it?

596






Which are low level languages?

642


What are the 4 data types?

604


What is sizeof int in c?

608


How can I find the modification date of a file?

708


What is the difference between ā€˜gā€™ and ā€œgā€ in C?

2647


Explain what is wrong with this statement? Myname = ?robin?;

1043


What type is sizeof?

592


What is structure and union in c?

605


Explain what is a const pointer?

643


what are enumerations in C

727