0
I want to solve a particular code using ternary operator alone. I also tried it,it also works fine , you can see that code below
Please tell me,is my code is good enough ? Or I need to improve my code like indentation, declaration etc Please note that: problem should be solved only using ternary operator https://code.sololearn.com/coGuU3BdwZsh/?ref=app
2 ответов
+ 3
You could use a single printf and pass the argument comditionally using the ternary operator, like so
`
printf((iside1 == iside2 && iside2 == iside3)? "equilateral triangle":((iside1!=iside2 && iside2!=iside3 && iside1!=iside3)?"scalene triangle":"isosceles triangle"));
`
but that won't make any difference except make your code like 1% more readable.
I don't know where you got this problem, but using ternary operators like this is just dumb. It makes your code really unreadable without actually benefitting you greatly.
0
Thank you XXX for yours reply and feedback about my code😃