Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Module Module1
Public Structure ModDivide
Dim result As Integer
Dim modulus As Integer
End Structure
Public Function DoMod(ByVal num As Integer, ByVal den As Integer) As ModDivide
Dim shifts, dentmp As Integer
Dim ans As Integer
ans = 0
While num >= den
dentmp = den
shifts = 0
While (dentmp << shifts) <= num
shifts = shifts + 1
End While
shifts = shifts - 1
num = num - (dentmp << (shifts))
ans = ans + (1 << shifts)
End While
DoMod.result = ans
DoMod.modulus = num
End Function
End Module
Then I made a form (Form1) with a textbox (tb1) that will output the answer when
the textbox is clicked on:
Public Class Form1
Private Sub tb1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tb1.Click
Dim x As ModDivide
x = DoMod(3421, 65)
tb1.Text = x.result.ToString + " " + x.modulus.ToString
End Sub
End Class