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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / april

#include<stdio.h>
#include<conio.h>

using namespace std;
int main();
{
int i,j;
int num[20],i,odd=0,even=0,n;
cout<<("enter the size of the array",n);
cin>>("%d",&n);

cout<<("Enter the %d array elements",n);
for(i=20;i<n;i++);
{
cout<<("%d",&num[i]);
}
for(i=0;i<n;i++);
{
if(num[i]%2==0);
{
even++;
}
else
{
odd++;
}
}
cout<<("\n The number of even numbers in the array :%
d ",even);
cout<<("\n The number of odd numbers in the array : %
d",odd);
getch();
system("pause");
}

Is This Answer Correct ?    25 Yes 37 No

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

Answer / jasna.c

#include<stdio.h>
#include<conio.h>
void main()
{
int arr[100],i,odd=0,even=0,n;
printf("enter the size of the array");
scanf("%d",&n);
printf("Enter the %d array elements",n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<n;i++)
{
if(arr[i]%2==0)
{
even++;
}
else
{
odd++;
}
}
printf("\n The number of even numbers in the array :%d ",even);
printf("\n The number of odd numbers in the array : %d",odd);
getch();
}

Is This Answer Correct ?    26 Yes 41 No

Post New Answer

More C Interview Questions

How can I allocate arrays or structures bigger than 64K?

5 Answers  


What is 2 d array in c?

0 Answers  


What is register variable in c language?

0 Answers  


Write a C++ program to give the number of days in each month according to what the user entered. example: the user enters June the program must count number of days from January up to June

0 Answers  


What is new line escape sequence?

0 Answers  






array contains zeros and ones as elements.we need to bring zeros one side and one other side in single parse. ex:a[]={0,0,1,0,1,1,0,0} o/p={0,0,0,0,0,1,1,1}

12 Answers   Google, Motorola,


What does double pointer mean in c?

0 Answers  


An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

0 Answers  


What is volatile variable how do you declare it?

0 Answers  


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

0 Answers  


By using C language input a date into it and if it is right?

0 Answers   Aricent,


What does c in a circle mean?

0 Answers  


Categories