VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



convert any decimal to its binary equivalent, autosize the binary number, for ex: (5) in base 10 --

by sherif rofael (15 Submissions)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 22nd July 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

convert any decimal to its binary equivalent, autosize the binary number, for ex: (5) in base 10 ----->(101)in base 2 and not (0101), can

API Declarations


' http://sherif1.netfirms.com/bin.zip
'how to use:
'(1) make a textbox name it "x" to put decimal in.
'(2) make a textbox name it "y" to get binary from.
'(3) command box its name is command1
' by : sherif rofael.
' mailto : [email protected]
' website:
' http://sherif1.netfirms.com
' http://vbsherif.members.easyspace.com (to download the programs)

Rate convert any decimal to its binary equivalent, autosize the binary number, for ex: (5) in base 10 --



u = Int(Log(d) / Log(2))
End Function
Function Bin(n As Double)
Dim s As String, i As Integer
uu = u(x)
For i = 0 To uu
s = (n Mod 2) & s
t = n / 2
n = Int(t)
Next
Bin = s
End Function

Private Sub Command1_Click()
y = Bin(x)
End Sub



Download this snippet    Add to My Saved Code

convert any decimal to its binary equivalent, autosize the binary number, for ex: (5) in base 10 -- Comments

No comments have been posted about convert any decimal to its binary equivalent, autosize the binary number, for ex: (5) in base 10 --. Why not be the first to post a comment about convert any decimal to its binary equivalent, autosize the binary number, for ex: (5) in base 10 --.

Post your comment

Subject:
Message:
0/1000 characters