Program Mencari FPB

Codingnya :

Private Sub Proses_Click()
a = Angka1.Text
b = Angka2.Text
If a < b Then
x = b
ElseIf b < a Then
x = a
End If
For i = 1 To x

If a Mod i = 0 Then
Fak1.Text = Fak1.Text & " " & Str(i)
End If

If b Mod i = 0 Then
Fak2.Text = Fak2.Text & " " & Str(i)
End If

If a Mod i = 0 And b Mod i = 0 Then
c = i
End If
Next i
FPB.Text = c
End Sub

No comments:

Post a Comment