Count in octal: Difference between revisions
Content deleted Content added
add link to Delphi for pascal |
|||
Line 599: | Line 599: | ||
<lang PicoLisp>(for (N 0 T (inc N)) |
<lang PicoLisp>(for (N 0 T (inc N)) |
||
(prinl (oct N)) )</lang> |
(prinl (oct N)) )</lang> |
||
=={{header|PL/I}}== |
|||
<lang PL/I> |
|||
/* Do the actual counting in octal. */ |
|||
count: procedure options (main); |
|||
declare v(5) fixed(1) static initial ((5)0); |
|||
declare (i, k) fixed; |
|||
do k = 1 to 999; |
|||
call inc; |
|||
put skip edit ( (v(i) do i = 1 to 5) ) (f(1)); |
|||
end; |
|||
inc: proc; |
|||
declare (carry, i) fixed binary; |
|||
carry = 1; |
|||
do i = 5 to 1 by -1; |
|||
v(i) = v(i) + carry; |
|||
if v(i) > 7 then |
|||
do; v(i) = v(i) - 8; if i = 1 then stop; carry = 1; end; |
|||
else |
|||
carry = 0; |
|||
end; |
|||
end inc; |
|||
end count; |
|||
</lang> |
|||
=={{header|Python}}== |
=={{header|Python}}== |