Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE FUNCTION BINARY$ (ToBin&)
- INPUT "Enter a number to represent in binary"; number&
- PRINT BINARY$(number&); " ="; number&
- FUNCTION BINARY$ (ToBin&)
- result$ = ""
- FOR bit% = 0 TO 15
- result$ = CHR$(48 - ((ToBin& AND (2 ^ bit%)) <> 0)) + result$
- NEXT
- BINARY$ = result$
- END FUNCTION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement