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
hi, which software companys will take,if d candidate's % is jst 55%?
What is the meaning of 2d in c?
How can a process change an environment variable in its caller?
What is d'n in c?
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
What is void pointers in c?
Compare array data type to pointer data type
What is a null pointer in c?
Explain what is a program flowchart and explain how does it help in writing a program?
What is the difference between functions abs() and fabs()?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
When should the register modifier be used? Does it really help?
Why we use break in c?
What is the difference between procedural and functional programming?
what are the advantages of a macro over a function?