Non-decimal radices/Output: Difference between revisions

Go solution
m (→‎{{header|REXX}}: added REXX language.)
(Go solution)
Line 255:
The 99 beers and 0x2D Scotches.
The 99 (0x63, 0143) beers and 0x2D (45, 055) Scotches.</pre>
=={{header|Go}}==
<lang go>package main
 
import (
"big"
"fmt"
"strconv"
)
 
func main() {
// package strconv:
// Itoa is the most common int to string conversion. it is base 10 only.
x := strconv.Itoa(13)
fmt.Printf("%q\n", x)
 
// Itob64 handles arbitrary bases from 2 to 36.
x = strconv.Itob64(1313, 19)
fmt.Printf("%q\n", x)
 
// package fmt: allows direct conversion from integer
// to string types for bases 2, 8, 10, and 16.
fmt.Printf("%b\n", 13)
fmt.Printf("%o\n", 13)
fmt.Printf("%d\n", 13)
fmt.Printf("%x\n", 13)
 
// package big: string conversion is base 10 only.
fmt.Println(big.NewInt(13))
}</lang>
Output:
<pre>"13"
"3c2"
1101
15
13
d
13</pre>
 
=={{header|Haskell}}==
1,707

edits