write a program to find the number of even integers and odd
integers in a given array in c language

Answer Posted / nikhil patil

#include<stdio.h>
#include<conio.h>main()
{
int a[5],even=0,odd=1,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))
even++;
if((a[i]%2==1))
odd++;
}
printf("%d",even,);
printf ("%d",odd,);
getch();

Is This Answer Correct ?    32 Yes 44 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate abs() function from fabs() function.

615


What is the concatenation operator?

619


Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer

3852


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1530


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2066






what are # pragma staments?

1636


Do variables need to be initialized?

627


What is the difference between far and near ?

700


What does %d do in c?

554


write a program to print largest number of each row of a 2D array

1882


diff between exptected result and requirement?

1606


What is #include called?

581


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

1599


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1991


Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol

674