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 the types of bitwise operator?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
What is meant by high-order and low-order bytes?
What does 2n 4c mean?
Is there a built-in function in C that can be used for sorting data?
Which header file is essential for using strcmp function?
How do you search data in a data file using random access method?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
What are the 4 types of organizational structures?
What the different types of arrays in c?
What is queue in c?
What is the difference between test design and test case design?
What is huge pointer in c?
Do character constants represent numerical values?
Explain how can I make sure that my program is the only one accessing a file?