Write a program to print the addition of two numbers.
Checking even or odd number for a given number
Program implementation:-
#include<iostream> using namespace std; int isEven(int num) { return !(num & 1); } int main() { int num ; cout<<"Enter the number:"<<endl; cin>>num; if(isEven(num)) { cout<<"The given number is even. "; } else { cout<<"The given number is odd."; } return 0; }
Subscribe to:
Comments (Atom)