What\'s the difference between /
and \\
for division in VB.NET?
My code gives very different answers depending on which I use. I\'ve seen b
10 / 3 = 3.33333333333333, assigned to integer = 3
10 \ 3 = 3, assigned to integer = 3
20 / 3 = 6.66666666666667, assigned to integer = 7
20 \ 3 = 6, assigned to integer = 6
Code for the above:
Dim a, b, c, d As Integer
a = 10 / 3
b = 10 \ 3
c = 20 / 3
d = 20 \ 3
Debug.WriteLine("10 / 3 = " & 10 / 3 & ", assigned to integer = " & a)
Debug.WriteLine("10 \ 3 = " & 10 \ 3 & ", assigned to integer = " & b)
Debug.WriteLine("20 / 3 = " & 20 / 3 & ", assigned to integer = " & c)
Debug.WriteLine("20 \ 3 = " & 20 \ 3 & ", assigned to integer = " & d)