# vb.net 教程 1-5 运算符 1

    Sub Main()
Dim a, b As Integer
a = 20
b = 3
Dim i As Integer
i = a / b
Dim j As Single
j = a / b
Dim k As Double
k = a / b
Dim l As Decimal
l = a / b

Console.WriteLine("Integer：" & i)
Console.WriteLine("Single：" & j)
Console.WriteLine("Double：" & j)
Console.WriteLine("Decimal：" & l)
End Sub

    Sub main()
Dim a As Integer = 12
Dim b As Integer = 7

Dim c1 As Integer = a / b
Dim c2 As Single = a / b
Dim d As Integer = a \ b
Dim e As Integer = a Mod b

Dim f As Single = 9.6
Dim g As Single = f Mod b

Console.WriteLine(c1)
Console.WriteLine(c2)
Console.WriteLine(d)
Console.WriteLine(e)
Console.WriteLine(g)
End Sub

1、c1和c2的值，由于定义了c1是integer，所以结果四舍五入了。

2、\运算符，实际是对商进行了截断，去掉了小数点及后面的部分。

3、mod运算符对小数、负数也适用。