Count in octal: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: clarified number of digits to use in REXX. -- ~~~~ |
No edit summary |
||
Line 997: | Line 997: | ||
[[Category:Radices]] |
[[Category:Radices]] |
||
[[Category:Iteration]] |
[[Category:Iteration]] |
||
=={{header|XPL0}}== |
|||
XPL0 doesn't have built-in routines to handle octal; instead it uses hex. |
|||
<lang XPL0>include c:\cxpl\codes; \intrinsic code declarations |
|||
proc OctOut(N); \Output N in octal |
|||
int N; |
|||
int R; |
|||
[R:= N&7; |
|||
N:= N>>3; |
|||
if N then OctOut(N); |
|||
ChOut(0, R+^0); |
|||
]; |
|||
int I; |
|||
[I:= 0; |
|||
repeat OctOut(I); CrLf(0); |
|||
I:= I+1; |
|||
until KeyHit or I=0; |
|||
]</lang> |
|||
Example output: |
|||
<pre> |
|||
0 |
|||
1 |
|||
2 |
|||
3 |
|||
4 |
|||
5 |
|||
6 |
|||
7 |
|||
10 |
|||
11 |
|||
12 |
|||
13 |
|||
14 |
|||
15 |
|||
16 |
|||
17 |
|||
20 |
|||
21 |
|||
</pre> |