30 lines
740 B
Plaintext
30 lines
740 B
Plaintext
$ include "seed7_05.s7i";
|
|
|
|
const func string: suffix (in integer: num) is func
|
|
result
|
|
var string: suffix is "";
|
|
begin
|
|
if num rem 10 = 1 and num rem 100 <> 11 then suffix := "st";
|
|
elsif num rem 10 = 2 and num rem 100 <> 12 then suffix := "nd";
|
|
elsif num rem 10 = 3 and num rem 100 <> 13 then suffix := "rd";
|
|
else suffix := "th";
|
|
end if;
|
|
end func;
|
|
|
|
const proc: printImages (in integer: start, in integer: stop) is func
|
|
local
|
|
var integer: num is 0;
|
|
begin
|
|
for num range start to stop do
|
|
write(num <& suffix(num) <& " ");
|
|
end for;
|
|
writeln;
|
|
end func;
|
|
|
|
const proc: main is func
|
|
begin
|
|
printImages( 0, 25);
|
|
printImages( 250, 265);
|
|
printImages(1000, 1025);
|
|
end func;
|