Assign result to both an integer and a double
Imports System
Public Class MainClass
Shared Sub Main(ByVal args As String())
Dim int1 As Integer = 12
Dim int2 As Integer = 5
Dim intAnswer As Integer
Dim doubleAnswer As Double
Console.WriteLine("{0} + {1} = {2}", int1, int2, int1 + int2)
Console.WriteLine("{0} - {1} = {2}", int1, int2, int1 - int2)
Console.WriteLine("{0} * {1} = {2}", int1, int2, int1 * int2)
' integer division
intAnswer = int1 \ int2
doubleAnswer = int1 \ int2
Console.WriteLine("{0} \ {1} = [integer] {2} [double] {3}", _
int1, int2, intAnswer, doubleAnswer)
' division. Assign result to both an integer and a double
' note, option strict must be off!
intAnswer = int1 / int2
doubleAnswer = int1 / int2
Console.WriteLine("{0} / {1} = [integer] {2} [double] {3}", _
int1, int2, intAnswer, doubleAnswer)
End Sub
End Class
Related examples in the same category