0

Help me understand why b=0?

I got b equalling 0 as my result after I wrote this: var a = 2, b =4 b /= a print(b)

4th Jan 2020, 9:34 PM
otto man
otto man - avatar
2 Answers
+ 1
b/=a (b = b/a) b = 4/2 b=2
4th Jan 2020, 9:38 PM
Abdol Hashimi
Abdol Hashimi - avatar
+ 1
I checked your profile, this is the whole code, you didn't post it all. var a = 1, b = 5, c = 3 a += 2 + b print(a) b /= a print(b) -------+++++------ since a = 8 b / a = 0 5/8 = 0 because it is an integer division it is 0. convert a and b to Float.
4th Jan 2020, 11:49 PM
Bahha┣
Bahha┣ - avatar