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
Why are all header files not declared in every c program?
Why is c called c?
What are integer variable, floating-point variable and character variable?
What is floating point constants?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
Differentiate between a for loop and a while loop? What are it uses?
What are the different types of errors?
How macro execution is faster than function ?
What will be your course of action for a push operation?
What is the correct declaration of main?
What are the various types of control structures in programming?
why we wont use '&' sing in aceesing the string using scanf
cavium networks written test pattern ..
What is #define size in c?
What is nested structure with example?