- Home
·
- Math/Dates
·
- convert Binary numbers into Denary numbers and viceversa
convert Binary numbers into Denary numbers and viceversa
convert Binary numbers into Denary numbers and viceversa
Rate convert Binary numbers into Denary numbers and viceversa
(2(2 Vote))
Dim Denary As Integer
Dim Digit As Integer
Dim Answer As String
Denary = txtDenary
Do
Digit = Denary Mod 2
Denary = Denary \ 2
Answer = Digit & Answer
txtBinary = Answer
Loop Until Denary = 0
End Sub
Private Sub CmdDenary_Click()
Dim CurrDenMul As Integer
Dim CurrDenPos As Integer
Dim CurrDenChr As Integer
CurrDenMul = 1
DenaryNumber = txtBinary
For Position = 0 To (Len(DenaryNumber) - 1)
CurrDenPos = Len(DenaryNumber) - Position
CurrDenChr = Mid(DenaryNumber, CurrDenPos, 1)
BinaryNumber = BinaryNumber + (CurrDenMul * CurrDenChr)
CurrDenMul = CurrDenMul * 2
Next Position
txtDenary = BinaryNumber
BinaryNumber = 0
DenaryNumber = 0
End Sub
Private Sub CmdReset_Click()
txtBinary.Text = "Enter Binary No."
txtDenary.Text = "Enter Denary No."
End Sub
Private Sub txtBinary_Click()
txtBinary.Text = ""
txtDenary.Text = ""
End Sub
Private Sub txtDenary_Click()
txtBinary.Text = ""
txtDenary.Text = ""
End Sub
convert Binary numbers into Denary numbers and viceversa Comments
No comments yet — be the first to post one!
Post a Comment