方法一:
Dim n As Integer = 12345
Dim s As String = n
Dim l As Integer = s.Length
s = ("1").PadRight(l,"0")
Output.Show(n Mod val(s)) '求最末四位
Output.Show(n Mod (val(s)/10)) '求最末三位
Output.Show(n Mod (val(s)/100)) '求最末二位
Output.Show(n Mod (val(s)/1000)) '求最末一位
方法二:
Dim n As Integer = 12345
Dim s As String = n
Output.Show(Right(s,4)) '求最末四位
Output.Show(Right(s,3)) '求最末三位
Output.Show(Right(s,2)) '求最末二位
Output.Show(Right(s,1)) '求最末一位
后者相对简单实用。