Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
23
Task/Nth/SETL/nth.setl
Normal file
23
Task/Nth/SETL/nth.setl
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
program nth;
|
||||
loop for r in [[0..25], [250..265], [1000..1025]] do
|
||||
showrange(r);
|
||||
end loop;
|
||||
|
||||
proc showrange(r);
|
||||
i := 0;
|
||||
loop for s in [nth(n) : n in r] do
|
||||
putchar(rpad(s, 8));
|
||||
if (i +:= 1) mod 6 = 0 then print(); end if;
|
||||
end loop;
|
||||
print();
|
||||
end proc;
|
||||
|
||||
proc nth(n);
|
||||
sfx := {[1,"st"], [2,"nd"], [3,"rd"]};
|
||||
return str n +
|
||||
if n div 10 mod 10 = 1
|
||||
then "th"
|
||||
else sfx(n mod 10) ? "th"
|
||||
end if;
|
||||
end proc;
|
||||
end program;
|
||||
Loading…
Add table
Add a link
Reference in a new issue