Imports System.Math
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim a, b As Integer
Dim min, max As Integer
min = 100
max = 300
Randomize()
a = CInt((max - min) * Rnd() + min)
b = CInt((max - min) * Rnd() + min)
TextBox1.Text = a
TextBox2.Text = b
TextBox3.Text = getGreatestDivisor(a, b)
End Sub
Private Function getGreatestDivisor(ByVal m As Integer, ByVal n As Integer) As Integer
Dim c As Integer
c = m Mod n
While (c <> 0)
m = n
n = c
c = m Mod n
End While
Return n
End Function
End Class
如图所示,望采纳。。。