Which should be given first preference | Sololearn: Learn to code for FREE!

0

Which should be given first preference

If we give preference as stated in the lesson if we give preference as * / % + - Then if we execute program with a=6 b=4 c=2 then when we print result for Result=a-b+c It is showing output 4 But as per the order mentioned above we should get output of 0 so please Give me the original precedance which is perfect to be followed plz help me guys

2/19/2019 2:28:19 PM

QUICK SILVER

4 Answers

New Answer

+2

Thank u very much for the valuable info and ur time bro

+1

It might be quite a bit to read, but this should answer your question for C: https://en.cppreference.com/w/c/language/operator_precedence

0

+ and - have the same priority (precedence) , therefore whichever operation comes first, that one is executed. If you try b+c-a you would get 0

0