A conditional operator is also known as ternary operator [exp ? true : false] which can be used to make an either-or choice. Write a C++ program to get a number from the user and find out whether it is odd or even. INPUT & OUTPUT FORMAT: The input is an integer denoting the given number. If the given number is even, print "Even". Otherwise, print "Odd". SAMPLE INPUT & OUTPUT: 5 Odd Case 1 Case 2 Case 3 Input (stdin) 5 Output (stdout) Odd
Answers
Answered by
0
Public static void main
{
Cout<<“ enter the number”;
Cin>> n;
if( n%2 == 0) ? even:odd ;
}
Mark me as brainliest .Thank you
{
Cout<<“ enter the number”;
Cin>> n;
if( n%2 == 0) ? even:odd ;
}
Mark me as brainliest .Thank you
Similar questions