+ 9
Ternary operator
Why the condition evaluated to true ? https://code.sololearn.com/cdR8rHWvw897/?ref=app
8 Answers
+ 5
It 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
+ 5
yes yes you are right thanks
+ 5
i think there is no need for that in this situation
it was a question in one of challenges in Sololearn
+ 4
20/10 is 2 and any number greater than 0 evalutes to True ,hence a is the answer
+ 3
no worries, I would say Abhay answer is best as this is the reason it's true đ
+ 2
Abhay not Only greater than 0 is true but any non zero value evaluates true ... so that number less than zero also evaluates true..!
0
please how can I be a good programmer?
0
Mustafa Jafar first learn concept clearly and then do practice .
"practice makes man perfect"
so, keep practicing and practice will develop your logical thinking đ