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

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

Answer / rahul khare

#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 ?    134 Yes 75 No

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

Answer / shuvendu sekhar sahu

#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 ?    54 Yes 45 No

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

Answer / anup majhi

#include<stdio.h>
#include<conio.h>
#define size 100
void check(int[],int);
int i;
main(){
int a[size],m
printf("Enter the array length ");
scanf("%d",&m);
printf("Supply elements to the array ");
for(i=0;i<m;i++)
scanf("%d",&a[i]);
check(a,m);
}
void check(int a[],int b){
int even=0,odd=0;
for(i=0;i<b;i++){
if(a[i]%2==0)
even++;
else
odd++;
}
printf("Number of even no. in the array =%d ",even);
printf("\nNumber of odd no. in the array =%d ",odd);
}


out put:
Enter the array length 5
Supply array elements 1 2 3 4 5
Number of even no. in the array =2
Number of odd no. in the array =3

Is This Answer Correct ?    11 Yes 4 No

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

Answer / ravestar

#include<stdio.h>
#include<iostream.h>
#include<conio.h>
main()
{clrscr();
int a[5],count_even=0,count_odd=0,i;

for(i=0;i<5;i++)

scanf("%d",&a[i]);
for(i=0;i<5;i++)
{
if((a[i]%2 ==0))
count_even++;
if((a[i]%2==1))
count_odd++;
}
cout<<"Even:"<<count_even<<"\n"<<"Odd:"<<count_odd;
getch();
}

Is This Answer Correct ?    8 Yes 7 No

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

Answer / ankit kr. sharma

#include<stdio.h>
#include<conio.h>
void main()
{

int a[10],i,neg=0,even=0,odd=0;
printf("Enter the elements for the array:\n");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
printf("The array is:");
for(i=0;i<10;i++)
{
printf("%d\t", a[i]);
}
for(i=0;i<10;i++)
{
if (a[i]<0)
neg++;
else if(a[i]%2==0)
even++;
else
odd++;
}

printf("\nthe odd no.s in the array are: %d\t",odd);
printf("\nthe negative no.s in the array are: %d\t",neg);
printf("\nthe even no.s in the array are: %d\t",even);
}

Is This Answer Correct ?    10 Yes 11 No

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

Answer / ankit kumar sharma

#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 ?    13 Yes 16 No

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

Answer / merlin

#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 ?    15 Yes 19 No

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

Answer / ks djd

#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 ?    7 Yes 17 No

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

Answer / anshul

#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 ?    6 Yes 16 No

Post New Answer

More C Interview Questions

"I LOVE MY COUNTRY" write a c program to get "COUNTRY MY LOVE I" as the output. Use any other programming language. It is not mandatory to use C.

11 Answers   ABC Infotech, ADP, College School Exams Tests, Kovair,


write a program to find the sum of the array elements in c language?

24 Answers   ICT, Infosys, Wipro,


I have one doubt. What does below statement mean? #define sizeof(operator) where operator can be int or float etc. Does this statement meaningful and where it can be used?

1 Answers  


What is an object?

5 Answers  


Create a simple code fragment that will swap the values of two variables num1 and num2.

0 Answers  






34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?

3 Answers  


write a program to find lcm and hcf of two numbers??

1 Answers  


what is array?

8 Answers  


Where are local variables stored in c?

0 Answers  


What are the disadvantages of a shell structure?

0 Answers  


find the size of structure without using the size of function

1 Answers   Bosch,


What is variable initialization and why is it important?

0 Answers  


Categories