以前我們會直接求出
Dim Integer As Integer = a \ b '商數
Dim Remainder As Integer = a Mod b '餘數
現在 ms 有新的選擇
好不好用就見人見智了 ^^
Dim int1 As Integer = Int32.MaxValue
Dim int2 As Integer = Int32.MaxValue
Dim intResult As Integer
Console.WriteLine("{0}Calculate the quotient and remainder of two Int32 values:", nl)
intResult = Math.DivRem(int1, 2, int2)
Console.WriteLine("{0}/{1} = {2}, with a remainder of {3}.", int1, 2, intResult, int2)
詳情請參考 MS 的 MSDN
沒有留言:
張貼留言