Binary digits: Difference between revisions
Content deleted Content added
→{{header|F Sharp|F#}}: added method to use with "%a" which is a specific technique for F# and not available directly in C#, for instance |
No edit summary |
||
Line 2,501: | Line 2,501: | ||
1111111111111111111111111111111 |
1111111111111111111111111111111 |
||
</pre> |
</pre> |
||
=={{header|PowerBASIC}}== |
|||
Pretty simple task in PowerBASIC since it has a built-in BIN$-Function. Omitting the second parameter ("Digits") means no leading zeros in the result. |
|||
<lang powerbasic> |
|||
#COMPILE EXE |
|||
#DIM ALL |
|||
#COMPILER PBCC 6 |
|||
FUNCTION PBMAIN () AS LONG |
|||
LOCAL i, d() AS DWORD |
|||
REDIM d(2) |
|||
ARRAY ASSIGN d() = 5, 50, 9000 |
|||
FOR i = 0 TO 2 |
|||
PRINT STR$(d(i)) & ": " & BIN$(d(i)) & " (" & BIN$(d(i), 32) & ")" |
|||
NEXT i |
|||
END FUNCTION</lang> |
|||
{{out}}<pre> |
|||
5: 101 (00000000000000000000000000000101) |
|||
50: 110010 (00000000000000000000000000110010) |
|||
9000: 10001100101000 (00000000000000000010001100101000) |
|||
</pre> |
|||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |