write a program to find the number of even integers and odd
integers in a given array in c language
Answer Posted / lakshmi
#include<studio.h>
#include<conio.h>
main()
{
int a[5],count_even=0,count_odd=0,i;
for(i=0;i<5;i++)
scanf("%d",&a[i]);
/* display the 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++;
}
printf("%d %d",count_even,count_odd);
getch();
}
| Is This Answer Correct ? | 217 Yes | 96 No |
Post New Answer View All Answers
What is the c language function prototype?
How do you redirect a standard stream?
What are control structures? What are the different types?
Process by which one bit pattern in to another by bit wise operation is?
What are the three constants used in c?
Why is c used in embedded systems?
What the advantages of using Unions?
What is wrong with this program statement? void = 10;
What are the different types of linkage exist in c?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
What is function prototype in c language?
Can a local variable be volatile in c?
What is a newline escape sequence?
Write a program to check armstrong number in c?
Explain what are compound statements?