Cout<<8+2*3%7;. //Output =14 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Cout<<8+2*3%7;. //Output =14

Explanation on output (how to solve)

28th Mar 2017, 1:30 PM
Mayank
5 Answers
+ 20
8+2*3%7 = 8+ 6%7 = 8+ 6 = 14 Explanation: + has less preference than the other 2 operations. * and % gets equal preference, So, between * and %, the order of operations must be left associative. So multiplication works first as it is in left. If you divide any small number by a large number, the remainder should be the small number itself.
28th Mar 2017, 1:38 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 16
If you divide 6 by 7, then the quotient will be 0 Since 7*0 = 0, so remainder should be 6-0=6 Welcome 😊
28th Mar 2017, 6:06 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
% gives the remainder hence 6%7 comes out to be 6. ie. [ 7 (0)+6]
30th Mar 2017, 7:06 AM
Mukul Yadav
Mukul Yadav - avatar
0
First of all thanks
28th Mar 2017, 5:29 PM
Mayank
0
yeah but here I'm facing the problem how 6℅7 is ==6 shouldn't it be 4?
28th Mar 2017, 5:30 PM
Mayank