Binary digits: Difference between revisions
Content added Content deleted
(Added Epoxy) |
|||
Line 4,185: | Line 4,185: | ||
50 printBinary |
50 printBinary |
||
9000 printBinary</lang> |
9000 printBinary</lang> |
||
Other solution |
|||
<lang Phixmonti>/# Rosetta Code problem: http://rosettacode.org/wiki/Binary_digits |
|||
by Galileo, 05/2022 #/ |
|||
include ..\Utilitys.pmt |
|||
def printBinary |
|||
0 >ps >ps |
|||
( "The decimal value " tps " should produce an output of " ) lprint |
|||
ps> 8 int>bit |
|||
( len 1 -1 ) for |
|||
get dup ps> or if print 1 >ps else drop 0 >ps endif |
|||
endfor |
|||
nl |
|||
enddef |
|||
5 printBinary |
|||
50 printBinary |
|||
9000 printBinary |
|||
</lang> |
|||
{{out}} |
|||
<pre>The decimal value 5 should produce an output of 101 |
|||
The decimal value 50 should produce an output of 110010 |
|||
The decimal value 9000 should produce an output of 101000 |
|||
=== Press any key to exit ===</pre> |
|||
=={{header|PHP}}== |
=={{header|PHP}}== |