0

Solve the expression 100%20-5*7>1&&0||6

in C language can anyone find the solution plzz

24th Sep 2017, 9:07 AM
Samrudh MK Acharya
Samrudh MK Acharya - avatar
1 Answer
+ 8
Look at this page on order of precedence in C: http://en.cppreference.com/w/c/language/operator_precedence So firstly you do 100 % 20 which is 0: 0 - 5*7 > 1&&0||6, then 5*7 is 37 and 0 - 35 is - 35: -35 > 1&&0||6, after that - 35 > 1 gives out "false" which has a numeric value of 0: 0&&0||6, next 0&&0 is false&&false which is again false: 0||6, and finally the "or" operator is true if one value is true, 0 is false and any value other than 0, false, undefined, etc. is truey, truey or false is true and the numeric value of true is 1 so that is the answer.
24th Sep 2017, 9:50 AM
LynTon
LynTon - avatar