A Binary Printing with only 10 lines of code
This procedure prints the binary code of a number on Immediate window.
Inputs
Num as Long
Assumes
You can easily change the procedure to a function for returning the binary code.
Returns
Nothing
Rate A Binary Printing with only 10 lines of code
(4(4 Vote))
Public Sub PrintBinary(Num As Long)
Dim j&, i&
j = 128
For i = 8 To 1 Step -1
If (Num And j) = 0 Then
Debug.Print "0";
Else
Debug.Print "1";
End If
j = j / 2
Next
End Sub
A Binary Printing with only 10 lines of code Comments
No comments yet — be the first to post one!
Post a Comment