Anonymous user
Non-decimal radices/Output: Difference between revisions
Add source for Rust
(Add source for Rust) |
|||
Line 1,209:
=={{header|Phixmonti}}==
<lang Phixmonti>33 for
endfor</lang>
Line 1,284:
Binary (b), Octal (o), Decimal (d), and Hexadecimal (X and x) are supported by the [http://www.python.org/dev/peps/pep-3101/ format]method of a string
<div style="height:30ex;overflow:scroll"><lang python>>>> for n in range(34):
0 0 0 0
1 1 1 1
Line 1,329:
Octal (o), Decimal (d), and Hexadecimal (X and x), but not binary are supported by the string modulo operator, %:
<lang python>for n in range(34):
----
Line 1,599:
100.to_s(36) => 2s
</div>
=={{header|Rust}}==
<lang Rust>fn main() {
// To render the number as string, use format! macro instead
println!("Binary: {:b}", 0xdeadbeefu32);
println!("Binary with 0b prefix: {:#b}", 0xdeadbeefu32);
println!("Octal: {:o}", 0xdeadbeefu32);
println!("Octal with 0o prefix: {:#o}", 0xdeadbeefu32);
println!("Decimal: {}", 0xdeadbeefu32);
println!("Lowercase hexadecimal: {:x}", 0xdeadbeefu32);
println!("Lowercase hexadecimal with 0x prefix: {:#x}", 0xdeadbeefu32);
println!("Uppercase hexadecimal: {:X}", 0xdeadbeefu32);
println!("Uppercase hexadecimal with 0x prefix: {:#X}", 0xdeadbeefu32);
}</lang>
=={{header|Run BASIC}}==
<lang runbasic>
print asc("X")
print chr$(169)
print dechex$(255)
print hexdec("FF")
print str$(467)
print val("27")
</lang>
Line 1,803 ⟶ 1,817:
=={{header|Yabasic}}==
<lang Yabasic>for i = 1 to 33
next
</lang>
|