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

Why is structure padding done in c?

0 Answers  


what is the difference b/w compiler and debugger?

2 Answers   Assurgent,


which header file contains main() function in c?

17 Answers   Google, HCL, TCS,


what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);}

9 Answers   TCS,


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

0 Answers  






How to explain the final year project as a fresher please answer with sample project

0 Answers  


What is C language ?

0 Answers   Jekson,


Can static variables be declared in a header file?

0 Answers  


how to devloped c lenguege?

4 Answers  


Difference between null pointer and dangling pointer?

7 Answers   GE, Wipro,


what is recursion in C

0 Answers   Cap Gemini,


Write a C program to perform some of the operation which can be performed using Single linked list

1 Answers   Qualcomm,


Categories