write a program to find the number of even integers and odd
integers in a given array in c language
Answer Posted / anup majhi
#include<stdio.h>
#include<conio.h>
#define size 100
void check(int[],int);
int i;
main(){
int a[size],m
printf("Enter the array length ");
scanf("%d",&m);
printf("Supply elements to the array ");
for(i=0;i<m;i++)
scanf("%d",&a[i]);
check(a,m);
}
void check(int a[],int b){
int even=0,odd=0;
for(i=0;i<b;i++){
if(a[i]%2==0)
even++;
else
odd++;
}
printf("Number of even no. in the array =%d ",even);
printf("\nNumber of odd no. in the array =%d ",odd);
}
out put:
Enter the array length 5
Supply array elements 1 2 3 4 5
Number of even no. in the array =2
Number of odd no. in the array =3
| Is This Answer Correct ? | 11 Yes | 4 No |
Post New Answer View All Answers
Can main () be called recursively?
Can a variable be both const and volatile?
Is struct oop?
What is the difference between pure virtual function and virtual function?
How do you print only part of a string?
What are formal parameters?
What are different types of variables in c?
What are the 4 types of organizational structures?
Explain how do you convert strings to numbers in c?
Explain how can I make sure that my program is the only one accessing a file?
Where are the auto variables stored?
What is c system32 taskhostw exe?
What is structure in c definition?
Is c compiled or interpreted?
What is gets() function?