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
Give me the code of in-order recursive and non-recursive.
Differentiate call by value and call by reference?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is the size of structure in c?
Which is best book for data structures in c?
Is struct oop?
What is the use of volatile?
writ a program to compare using strcmp VIVA and viva with its output.
If null and 0 are equivalent as null pointer constants, which should I use?
What is static function in c?
What does the characters “r” and “w” mean when writing programs that will make use of files?
What is the use of parallelize in spark?
Why is it important to memset a variable, immediately after allocating memory to it ?
How can I find out how much free space is available on disk?
Explain bitwise shift operators?