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 *

Hire a server Expert to resolve the issue Now.

Hire a server Expert to resolve the issue Now.

Resolve this issue in just 5$ from https://serverexpert.io

 

You have Successfully Subscribed!

Open chat