Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home »   C++   » Solved Programs on C++ » C++ program to check if sequence of nos

C++ program to check if sequence of nos are even or odd

#include#include
using namespace std;

int even(int no)
{
if(no%2 == 0)
return 1;
else
return 0;
}

int main()
{
int no;
int result = 0;
cout<<"\n Enter any no: ";
cin>>no;

result = even(no);

if(result == 1)
cout<<"\n No is even";
else
cout<<"\n No is odd";


cout<<"\n Enter any no: ";
cin>>no;

result = even(no);

if(result == 1)
cout<<"\n No is even";
else
cout<<"\n No is odd";


cout<<"\n Enter any no: ";
cin>>no;

result = even(no);

if(result == 1)
cout<<"\n No is even";
else
cout<<"\n No is odd";


cout<<"\n Enter any no: ";
cin>>no;

result = even(no);

if(result == 1)
cout<<"\n No is even";
else
cout<<"\n No is odd";

return 0;
}