RosettaCodeData/Task/Trabb-Pardo-Knuth-algorithm/PL-I/trabb-pardo-knuth-algorithm...

26 lines
545 B
Plaintext

Trabb: Procedure options (main); /* 11 November 2013 */
declare (i, n) fixed binary;
declare s fixed (5,1) controlled;
declare g fixed (15,5);
put ('Please type 11 values:');
do i = 1 to 11;
allocate s;
get (s);
put (s);
end;
put skip(2) ('Results:');
do i = 1 to 11;
g = f(s); put skip list (s);
if g > 400 then put ('Too large'); else put (g);
free s;
end;
f: procedure (x) returns (fixed(15,5));
declare x fixed (5,1);
return (sqrt(abs(x)) + 5*x**3);
end f;
end Trabb;