#include<conio.h>
#include<iostream.h>
main( )
{
int var1;
//accept input
cout<<”Enter value for var1 :- ”;
cin>>var1;
var1 % 2 == 0 ? cout<<”Number is even” : cout<<”Number is odd”;
getch();
}
Output:
Enter value for var1 :- 10
Number is even

Advertisements