Write a CPP program to check whether a given number is even or odd

 Code:-

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout<<“enter a numbern”;
cin>>n;
if(n%2==0)
cout<<“This is a even number”;
else
cout<<“This is a odd number”;
return 0;
}

Output:-

enter a number
12
This is a even number



Leave a Reply

Your email address will not be published.