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

What is zero based addressing?

0 Answers  


What is meant by inheritance?

0 Answers  


regarding the scope of the varibles;identify the incorrect statement: a.automatic variables are automatically initialised to 0 b.static variables are are automatically initialised to 0 c.the address of a register variable is not accessiable d.static variables cannot be initialised with any expression

1 Answers   TCS,


c pgm count no of lines , blanks, tabs in a para(File concept)

2 Answers  


Can you apply link and association interchangeably?

0 Answers   InterGraph,






what is the difference between const char *p, char const *p, const char* const p

5 Answers   Accenture, Aricent, CTS, Geometric Software, Point Cross, Verizon,


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

0 Answers  


I need testPalindrome and removeSpace #include <stdio.h> #define SIZE 256 /* function prototype */ /* test if the chars in the range of [left, right] of array is a palindrome */ int testPalindrome( char array[], int left, int right ); /* remove the space in the src array and copy it over to the "copy" array */ /* set the number of chars in the "copy" array to the location that cnt points t */ void removeSpace(char src[], char copy[], int *cnt); int main( void ) { char c; /* temporarily holds keyboard input */ char string[ SIZE ]; /* original string */ char copy[ SIZE ]; /* copy of string without spaces */ int count = 0; /* length of string */ int copyCount; /* length of copy */ printf( "Enter a sentence:\n" ); /* get sentence to test from user */ while ( ( c = getchar() ) != '\n' && count < SIZE ) { string[ count++ ] = c; } /* end while */ string[ count ] = '\0'; /* terminate string */ /* make a copy of string without spaces */ removeSpace(string, copy, &copyCount); /* print whether or not the sentence is a palindrome */ if ( testPalindrome( copy, 0, copyCount - 1 ) ) { printf( "\"%s\" is a palindrome\n", string ); } /* end if */ else { printf( "\"%s\" is not a palindrome\n", string ); } /* end else */ return 0; /* indicate successful termination */ } /* end main */ void removeSpace(char src[], char copy[], int *cnt) { } int testPalindrome( char array[], int left, int right ) { }

0 Answers  


What is far pointer in c?

0 Answers  


Why should I prototype a function?

0 Answers  


What is the 'named constructor idiom'?

0 Answers  


What is class and object in c?

0 Answers  


Categories