Introduction:
In this article i have written a
program to check whether the entered number is even number or the odd number
using C++ language.
Implementation: Let's check it out with an example program.
#include<conio.h>
#include<iostream.h>
main()
{
cout<<"Enter any number: ";
cin>>num;
if(num%2==0)
cout<<num<<" is even number";
else
cout<<num<<" is odd number";
getch();
}
- Now run the program using Ctrl+F9
Output:
First Run:
Enter
any number: 19
19
is odd number
Second Run:
Enter
any number: 18
18
is even number
0 comments:
Post a Comment