0

Run and check the output of this code and explain why it is printing 0 ?

a=3%2 b=1 c=2*3 print(a+b-c+4*a)

4th Aug 2017, 7:00 PM
Deepak Ranghar
Deepak Ranghar - avatar
2 Respostas
+ 2
a = 1 b = 1 c = 6 Using the order of operations, a + b = 2, 4 * a = 4, so 2 - 6 = -4, and -4 + 4 = 0. Make sure to check your order of operations if you are looking for a different output, or put parentheses around anything you want done first.
4th Aug 2017, 7:11 PM
Ravi G.
Ravi G. - avatar
0
then if I print(b+a-c+4*a) it show memory exceeded error why it happening
4th Aug 2017, 7:18 PM
Deepak Ranghar
Deepak Ranghar - avatar