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
p*=(++q)++*--p when p=q=1 while(q<=6)
What do mean by network ?
What are the scope of static variables?
How can I get random integers in a certain range?
How many bytes are occupied by near, far and huge pointers (dos)?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
in linking some of os executables are linking name some of them
Is it possible to execute code even after the program exits the main() function?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
Explain what is the benefit of using enum to declare a constant?
Suggesting that there can be 62 seconds in a minute?
What are header files in c programming?
What is the right type to use for boolean values in c? Is there a standard type?
What is clrscr in c?
Are bit fields portable?