Print whether the given integer is positive or negative in cpp? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Print whether the given integer is positive or negative in cpp?

without using 1)no function other than main 2)no conditional statements 3)no shift operators 4)no logical operators 5)no loops 6)no arithmetic operators 6)no relational operators ternary operator can be used

27th Jul 2018, 2:27 PM
Ravindra Babu
2 Answers
0
cout << (x<0 ? "negative" : "positive");
27th Jul 2018, 5:37 PM
Bebida Roja
Bebida Roja - avatar
4th Aug 2018, 8:13 AM
Ravindra Babu