Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Nth/PL-I/nth.pli
Normal file
26
Task/Nth/PL-I/nth.pli
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
Nth: procedure options (main); /* 1 June 2014 */
|
||||
declare i fixed (10);
|
||||
|
||||
do i = 0 to 25, 250 to 265, 1000 to 1025;
|
||||
if i = 250 | i = 1000 then put skip (2);
|
||||
put edit (enth(i)) (x(1), a);
|
||||
end;
|
||||
|
||||
enth: procedure (i) returns (character (25) varying);
|
||||
declare i fixed (10);
|
||||
declare suffix character (2);
|
||||
|
||||
select (mod(i, 10));
|
||||
when (1) suffix = 'st';
|
||||
when (2) suffix = 'nd';
|
||||
when (3) suffix = 'rd';
|
||||
otherwise suffix = 'th';
|
||||
end;
|
||||
select (mod(i, 100));
|
||||
when (11, 12, 13) suffix = 'th';
|
||||
otherwise ;
|
||||
end;
|
||||
return ( trim(i) || suffix );
|
||||
end enth;
|
||||
|
||||
end Nth;
|
||||
Loading…
Add table
Add a link
Reference in a new issue