+ 1

why this results to 495? can someone explain?

a = 5 b = 10 b, a = a, b print (b*a*a-b) 10*5*5-10 --i think i missed something

15th Jul 2019, 4:11 PM
Jerwin Peralta
Jerwin Peralta - avatar
3 Respostas
+ 2
Yes, you did. b, a = a, b basically switches the two variables. So it's not 10 * 5 * 5 - 10, but 5 * 10 * 10 - 5, which is 495
15th Jul 2019, 4:15 PM
Airree
Airree - avatar
+ 3
a=5 b=10 After b,a=a,b a=10 b=5 then b*a*a-b= 5*10*10-5=500-5 =495
15th Jul 2019, 4:15 PM
tejaswi kanneganti
tejaswi kanneganti - avatar
+ 1
Ohhh i see , thank youuu that's also what i thought about thanks for clarifying 😊 Godbless you!
15th Jul 2019, 4:16 PM
Jerwin Peralta
Jerwin Peralta - avatar