Count in octal: Difference between revisions

Previous version did not run until the maximum value was reached
m (Added Ada code)
(Previous version did not run until the maximum value was reached)
Line 7:
 
procedure Octal is
X: Integer;
package IIO is new Ada.Text_IO.Integer_IO(Integer);
begin
for I in 0 .. Integer'Last loop
Ada.Text_IO.Put_Line("Enter X; I'll count from 0 to 2**X -1 in octal");
IIO.GetPut(XI, Base => 8);
for I in 0 Ada.Text_IO. 2**X -1 loopPut_Line("");
IIO.Put(I, Base => 8, Width => ((X+14)/3));
end loop;
end Octal;</lang>
Output:
<pre>>./octal 8#0#
8#1#
Enter X; I'll count from 0 to 2**X -1 in octal
8#2#
5
8#3#
8#0# 8#1# 8#2# 8#3# 8#4# 8#5# 8#6# 8#7# 8#10# 8#11# 8#12# 8#13# 8#14# 8#15# 8#16# 8#17# 8#20# 8#21# 8#22# 8#23# 8#24# 8#25# 8#26# 8#27# 8#30# 8#31# 8#32# 8#33# 8#34# 8#35# 8#36# 8#37#</pre>
8#4#
 
8#5#
8#6#
8#7#
8#10#
8#11#
8#12#
8#13#
8#14#
8#15#
8#16#
8#17#
8#20#</pre>
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G|Any - tested with release [http://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.18.0/algol68g-1.18.0-9h.tiny.el5.centos.fc11.i386.rpm/download 1.18.0-9h.tiny].}}
Anonymous user