Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new

 Categories >> Software >> Programming Languages >> C

 C Interview Questions (2248) C++ Interview Questions (1106) VC++ Interview Questions (342) Delphi Interview Questions (510) Programming Languages AllOther Interview Questions (644)
Question
```write a program to find the number of even integers and odd
integers in a given array in c language```
Question Submitted By :: Srinivas
I also faced this Question!!     Rank Answer Posted By

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 1
#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 ? 178 Yes 75 No
Lakshmi

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 2
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],even=0,odd=0,i;
for(i=0;i<9;i++)
{
if(a[i]%2==0)
{
printf("%d\t",a[i]);
even++;
}
else
{
printf("%d\t",a[i]);
odd++;
}
}
printf("Total no of Even found is=%d",even);
printf("Total no of Odd found is=%d",odd);
getch();
}

 Is This Answer Correct ? 118 Yes 59 No
Rahul Khare

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 3
#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 ? 30 Yes 43 No
Nikhil Patil

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 4
#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 40 No
Jasna.c

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 5
#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 35 No
April

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 6
#include<stdio.h>
#include<conio.h>
main()
{
int x;
clrscr();
printf("Enter the value");
scanf("%d",& x);
if(x%2==0)
printf("x is even");
else
printf("x is odd");
getch();
}

 Is This Answer Correct ? 41 Yes 33 No
Shuvendu Sekhar Sahu

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 7
#include<studio.h>
#include<conio.h>
void main()
{
int a[20],even=0,odd=0,i,n;
printf("Enter the size of the array");
scanf("%d",&n);
printf("Enter the elements");
for(i=0;i<n;i++)
{

scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{

if((a[i]%2 ==0))
even++;
else
odd++;
}
printf("%d %d",even,odd);
getch();
}

 Is This Answer Correct ? 8 Yes 16 No
Merlin

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 8
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],count_even=0,count_odd=0,i;

printf("Enter the value in Array\n");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
/* Calculating 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++;
}
/* display the number of odd and even intergers */
printf(" Total number of even integer are %d\n ",count_even);
printf("Total number of odd integer are %d", count_odd);
getch();
}

 Is This Answer Correct ? 9 Yes 10 No
Ankit Kumar Sharma

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 9
#include<stdio.h>
void main()
{
int a[10],i,b;
for(i=0;i<10;i++)
{scanf("%d",&a[i]);
}
printf("enter element to be searched:");
scanf("%d",&b);
for(i=0;i<10;i++)
{
if(a[i]==b)
printf("element found at location %d\n",i);
}
}

 Is This Answer Correct ? 4 Yes 12 No
Ks Djd

Re: write a program to find the number of even integers and odd integers in a given array in c language
# 10
#include<stdio.h>
void main()
{
int a[10],i,b;
for(i=0;i<10;i++)
{scanf("%d",&a[i]);
}
printf("enter element to be searched:");
scanf("%d",&b);
for(i=0;i<10;i++)
{
if(a[i]==b)
printf("element found at location %d\n",i);
}
}
include

 Is This Answer Correct ? 4 Yes 9 No
Anshul

  Question Asked @ Answers Other C Interview Questions How will you allocate memory to double a pointer? 1 When do you say that a digraph is acyclic A)if and only if its first search does not have back arcs B)a digraph is acyclic if and only if its first search does not have back vertices C)if and only if its first search does not have same dfnumber D)None of these Accenture 1 What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack 6 In the below code, how do you modify the value 'a' and print in the function. You'll be allowed to add code only inside the called function. main() { int a=5; function(); // no parameters should be passed } function() { /* add code here to modify the value of and print here */ } 1 what is the difference between #include<> and #include”…”? 4 print ur name without using any semicolon in c/c++.... TCS 21 void main(int argc,char *argv[],char *env[]) { int i; for(i=1;i