Program to find Even or odd number using Array in C++.

In this program user provide data (numbers) to find even or odd numbers by using Array in C++.

 

Let’s open turboC++ and write the following Code .

 

 

//Code

 

 

//Add preprocessor

 

#include<iostream.h>

#include<conio.h>

void main()

{

long int   a[10],i;

//Clear Screen

clrscr();

cout<<”enter all numbers:”;

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

{

cin>>a[i];

}

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

{

if(a[i]%2==0)

{

cout<<”even number is :”<<a[i];

}

else

{

cout<<”odd number is :”<<a[i];

}

}

getch();

}

 

 

 

Step 2: Run the program and see output.

 

 

Output:

 

 

 

output

 

 

Happy Coding.

 

 

 

 

Tags: , , ,

Comments are closed.