I was asked this question recently.
In C, with the help of one printf statement, find the greater of 2 numbers say A & B.
I used ternary operator; although it contained two printf statements.
Can you guys help?
I was asked this question recently.
In C, with the help of one printf statement, find the greater of 2 numbers say A & B.
I used ternary operator; although it contained two printf statements.
Can you guys help?
Think about how you could use the conditional operator in an argument to printf.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
You can do it with one printf() statement. If you were going to print out one datum with printf(), where would you place that constant or variable? Hint! Hint!