Math.DivRem calculates the quotient and returns the remainder in an output parameter.
Module Example
Public Sub Main()
Dim dividends() As Integer = { Int32.MaxValue, 13, 0, -14,Int32.MinValue }
Dim divisors() As Integer = { 20, -20 }
For Each divisor As Integer In divisors
For Each dividend As Integer In dividends
Dim remainder As Integer
Dim quotient As Integer = Math.DivRem(dividend, divisor, remainder)
Console.WriteLine("{0:N0} \ {1:N0} = {2:N0}, remainder {3:N0}", _
dividend, divisor, quotient, remainder)
Next
Next
End Sub
End Module
Related examples in the same category