C++ program to find whether a number is even or odd

#include<iostream>
using namespace std;
int odd_even(int num);
int main()
{
int num,flag;
cout<<“Enter a number to check for odd or evenn “;
cin>>num;
flag=odd_even(num);
if(flag==1)
cout<<“Even”;
else
cout<<“odd”;

}
int odd_even(int num)
{

if(num%2==0)
return 1;
else
return 0;
}
OUTPUT:
Enter a number to check for odd or even
 3
odd

Leave a Comment

Your email address will not be published. Required fields are marked *

To Resolve this issue at just 5$ from ServerExpert

https://serverexpert.io/

For Hosting please visit Hostingwebsite.io

You have Successfully Subscribed!

Open chat