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


Please Help Members By Posting Answers For Below Questions

p*=(++q)++*--p when p=q=1 while(q<=6)

1270


What do mean by network ?

661


What are the scope of static variables?

604


How can I get random integers in a certain range?

617


How many bytes are occupied by near, far and huge pointers (dos)?

678






Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

678


in linking some of os executables are linking name some of them

1654


Is it possible to execute code even after the program exits the main() function?

822


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

631


Explain what is the benefit of using enum to declare a constant?

591


Suggesting that there can be 62 seconds in a minute?

601


What are header files in c programming?

660


What is the right type to use for boolean values in c? Is there a standard type?

568


What is clrscr in c?

682


Are bit fields portable?

681