How to Find the Given Number is Even Or Odd in C++


#include <iostream>

using namespace std;

int main()
{
    int num;
    cout << "Enter your number to check"<< endl;
    cin>>num;
    if(num%2==0)
    cout<<"number is even"<<endl;
    else
    cout<<"number is odd"<<endl;
    return 0;
}

No comments:

Post a Comment