TECHXCODE Under Construction

C++ Program to check if a number is even or odd

/* Program to check if a number is even or odd */

#include<iostream>
int main()
{
    using namespace std;
    int no;
    cout << "Enter the integer\t";
    cin >> no;
    if (no%2 == 0)                    //if no is divisible by 2, then no is even
    cout << no << " is even.";
    else
    cout << no << " is odd.";
    return 0;
}

0 Comments:

Post a Comment

 
Copyright © . TECHXCODE.COM - Posts · Comments
Theme Template by BTDesigner · Powered by Blogger