write a program to find the number of even integers and odd
integers in a given array in c language

Answer Posted / ankit kumar sharma

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],count_even=0,count_odd=0,i;

printf("Enter the value in Array\n");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
/* Calculating number of odd and even intergers */
for(i=0;i<5;i++)
{
if((a[i]%2 ==0))
count_even++;
if((a[i]%2==1))
count_odd++;
}
/* display the number of odd and even intergers */
printf(" Total number of even integer are %d\n ",count_even);
printf("Total number of odd integer are %d", count_odd);
getch();
}

Is This Answer Correct ?    13 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hi, which software companys will take,if d candidate's % is jst 55%?

1842


What is the meaning of 2d in c?

802


How can a process change an environment variable in its caller?

906


What is d'n in c?

797


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

810






What is void pointers in c?

754


Compare array data type to pointer data type

795


What is a null pointer in c?

811


Explain what is a program flowchart and explain how does it help in writing a program?

839


What is the difference between functions abs() and fabs()?

846


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

849


When should the register modifier be used? Does it really help?

769


Why we use break in c?

730


What is the difference between procedural and functional programming?

703


what are the advantages of a macro over a function?

847