better output formatting
This commit is contained in:
parent
fc6dfef67e
commit
b90a6de547
@ -2,15 +2,15 @@ with TEXT_IO; use TEXT_IO;
|
|||||||
|
|
||||||
procedure E is
|
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;
|
a : Array(0..200) of integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
h := 200;
|
h := 200;
|
||||||
x := 0;
|
x := 0;
|
||||||
n := h - 1;
|
n := h - 1;
|
||||||
d := 0;
|
|
||||||
y := 0;
|
|
||||||
|
|
||||||
Put( "starting... " ); New_line;
|
Put( "starting... " ); New_line;
|
||||||
while n > 0 loop
|
while n > 0 loop
|
||||||
@ -25,14 +25,18 @@ begin
|
|||||||
h := h - 1;
|
h := h - 1;
|
||||||
n := h;
|
n := h;
|
||||||
while 0 /= n loop
|
while 0 /= n loop
|
||||||
-- math simplified because complex expressions cause bad code to be generated
|
|
||||||
a( n ) := x REM n;
|
a( n ) := x REM n;
|
||||||
|
-- math simplified using local y because complex expressions cause bad code to be generated
|
||||||
y := a( n - 1 );
|
y := a( n - 1 );
|
||||||
x := ( y * 10 ) + ( x / n );
|
x := ( y * 10 ) + ( x / n );
|
||||||
n := n - 1;
|
n := n - 1;
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
Put( INTEGER'IMAGE( x ) );
|
if ( x >= 10 ) then
|
||||||
|
INTIO.PUT( x, 2 );
|
||||||
|
else
|
||||||
|
INTIO.PUT( x, 1 );
|
||||||
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
New_line;
|
New_line;
|
||||||
|
Loading…
Reference in New Issue
Block a user