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; }
No comments:
Post a Comment