Why the condition evaluated to true ? https://code.sololearn.com/cdR8rHWvw897/?ref=app
7/20/2020 10:49:47 PM
Ahmed Mahmoud8 Answers
New AnswerIt might be useful to use the equality operator with the ternary operator int c = b/a>=3 ? a:b; result here is false, as 20/2 is 2 which means that the result is not greater or equal to 3
i think there is no need for that in this situation it was a question in one of challenges in Sololearn
Abhay not Only greater than 0 is true but any non zero value evaluates true ... so that number less than zero also evaluates true..!
Mustafa Jafar first learn concept clearly and then do practice . "practice makes man perfect" so, keep practicing and practice will develop your logical thinking 👍
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message