i made application for computing totient function
but it doesn't give me any result
this is a code
but it doesn't give me any result
this is a code
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim n As Integer
n = CStr(TextBox1.Text)
Dim phi As Integer
Dim i As Integer
phi = 0
'Dim i As Integer
i = 1
Do While (i < n)
If (gcd(i, n) = 1) Then
phi = phi + 1
Else
Continue Do
End If
Loop
Label3.Text = phi
End Sub
Private Function gcd(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Dim i As Integer
Dim n As Integer
Dim Remainder As Integer
Do While (n <> 0)
Remainder = i Mod n
i = n
n = Remainder
Loop
gcd = i
Return gcd
Comment