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

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a c program to calculate sum of digits till it reduces to a single digit using recursion

2962


What is scope rule in c?

808


What is c value paradox explain?

767


What is structure data type in c?

730


Add Two Numbers Without Using the Addition Operator

539






What are the rules for the identifier?

862


What are the salient features of c languages?

829


Explain the use of bit fieild.

892


What are the back slash character constants or escape sequence charactersavailable in c?

906


What is a function simple definition?

827


How do you sort filenames in a directory?

910


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2388


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

3206


Explain why c is faster than c++?

788


What is #include stdio h?

889