better output formatting

This commit is contained in:
davidly 2024-07-08 14:02:30 -07:00
parent fc6dfef67e
commit b90a6de547

View File

@ -2,15 +2,15 @@ with TEXT_IO; use TEXT_IO;
procedure E is
h, n, x, d, y : integer;
package INTIO is new INTEGER_IO (INTEGER);
h, n, x, y : integer;
a : Array(0..200) of integer;
begin
h := 200;
x := 0;
n := h - 1;
d := 0;
y := 0;
Put( "starting... " ); New_line;
while n > 0 loop
@ -25,14 +25,18 @@ begin
h := h - 1;
n := h;
while 0 /= n loop
-- math simplified because complex expressions cause bad code to be generated
a( n ) := x REM n;
-- math simplified using local y because complex expressions cause bad code to be generated
y := a( n - 1 );
x := ( y * 10 ) + ( x / n );
n := n - 1;
end loop;
Put( INTEGER'IMAGE( x ) );
if ( x >= 10 ) then
INTIO.PUT( x, 2 );
else
INTIO.PUT( x, 1 );
end if;
end loop;
New_line;