Write a program to check whether the given number is even or odd (using ? : ternary operator )
#include<iostream.h>
#include<conio.h>
int main()
{
int a;
cout<<"Enter the Number : ";
cin>>a;
(a%2==0)?cout<<"Number is even":cout<<"Number is odd";
getch();
return 0;
}
No comments:
Post a Comment