Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
31
Task/Nth/CLU/nth.clu
Normal file
31
Task/Nth/CLU/nth.clu
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
nth = proc (n: int) returns (string)
|
||||
num: string := int$unparse(n)
|
||||
sfx: array[string] := array[string]$[0: "th", "st", "nd", "rd"]
|
||||
|
||||
if n / 10 // 10 = 1 cor n // 10 > 3 then
|
||||
return(num || sfx[0])
|
||||
else
|
||||
return(num || sfx[n // 10])
|
||||
end
|
||||
end nth
|
||||
|
||||
do_range = proc (from, to: int)
|
||||
po: stream := stream$primary_output()
|
||||
col: int := 0
|
||||
|
||||
for i: int in int$from_to(from,to) do
|
||||
stream$putleft(po, nth(i), 7)
|
||||
col := col + 1
|
||||
if col = 10 then
|
||||
stream$putc(po, '\n')
|
||||
col := 0
|
||||
end
|
||||
end
|
||||
stream$putl(po, "\n")
|
||||
end do_range
|
||||
|
||||
start_up = proc ()
|
||||
do_range(0,25)
|
||||
do_range(250,265)
|
||||
do_range(1000,1025)
|
||||
end start_up
|
||||
Loading…
Add table
Add a link
Reference in a new issue