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
What are external variables in c?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
What does %p mean?
What are the 5 organizational structures?
What is the c value paradox and how is it explained?
write a c program to find the sum of five entered numbers using an array named number
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What is a keyword?
What is dynamic memory allocation?
Are c and c++ the same?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
How can I find the modification date and time of a file?
What does 4d mean in c?
What does int main () mean?
What is a static function in c?