monteno

Dec2Bin

Mar 24th, 2011
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Private Sub Command1_Click()
  2. Dim res, numero As Single
  3. Label1.Caption = ""
  4. numero = Val(Text1.Text)
  5. Do
  6. res = numero Mod 2
  7. Label1.Caption = Label1.Caption + " " + Str(res)
  8. numero = Int(numero / 2)
  9. Loop Until numero < 2
  10. If numero = 1 Then
  11. Label1.Caption = "1 " + StrReverse(Label1.Caption)
  12. Else
  13. Label1.Caption = StrReverse(Label1.Caption)
  14. End If
  15. End Sub
Advertisement
Add Comment
Please, Sign In to add comment