Non-decimal radices/Output: Difference between revisions

Added FreeBASIC
(Added FreeBASIC)
Line 482:
write(*, "(b6, o4, i4, z4)") n, n, n, n
end do</lang>
 
=={{header|FreeBASIC}}==
FreeBASIC has built in functions called Hex, Str, Oct and Bin which convert decimal numbers into hexadecimal, decimal,
octal and binary strings respectively. Here's an example:
<lang freebasic>' FB 1.05.0 Win64
 
Dim ui(1 To 4) As UInteger = {10, 26, 52, 100}
Print "Decimal Hex Octal Binary"
Print "======= ======== ======= ======"
For i As Integer = 1 To 4
Print Str(ui(i)); Tab(12); Hex(ui(i)); Tab(23); Oct(ui(i)); Tab(31); Bin(ui(i))
Next
 
Sleep</lang>
 
{{out}}
<pre>
Decimal Hex Octal Binary
======= ======== ======= ======
10 A 12 1010
26 1A 32 11010
52 34 64 110100
100 64 144 1100100
</pre>
 
=={{header|Gema}}==
9,479

edits