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
How many types of arrays are there in c?
Can you define which header file to include at compile time?
How reliable are floating-point comparisons?
What is a stream in c programming?
What are the advantages of external class?
What is spark map function?
How to write a multi-statement macro?
What are the Advantages of using macro
What are pointers? What are different types of pointers?
What does c mean in standard form?
What is the significance of an algorithm to C programming?
Explain what is the difference between functions abs() and fabs()?
How do I get a null pointer in my programs?
What is the use of header files?
What is a file descriptor in c?