Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Nth/Elena/nth.elena
Normal file
29
Task/Nth/Elena/nth.elena
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import extensions;
|
||||
import system'math;
|
||||
import system'routines;
|
||||
|
||||
extension op
|
||||
{
|
||||
ordinalize()
|
||||
{
|
||||
int i := self.Absolute;
|
||||
if (new int[]{11,12,13}.ifExists(i.mod:100))
|
||||
{
|
||||
^ i.toPrintable() + "th"
|
||||
};
|
||||
|
||||
(i.mod(10)) =>
|
||||
1 { ^ i.toPrintable() + "st" }
|
||||
2 { ^ i.toPrintable() + "nd" }
|
||||
3 { ^ i.toPrintable() + "rd" };
|
||||
|
||||
^ i.toPrintable() + "th"
|
||||
}
|
||||
}
|
||||
|
||||
public program()
|
||||
{
|
||||
console.printLine(new Range(0,26).selectBy(mssgconst ordinalize<op>[1]));
|
||||
console.printLine(new Range(250,26).selectBy(mssgconst ordinalize<op>[1]));
|
||||
console.printLine(new Range(1000,26).selectBy(mssgconst ordinalize<op>[1]))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue