Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

26
Task/Nth/Rust/nth.rust Normal file
View file

@ -0,0 +1,26 @@
fn nth(num: int) -> String {
format!("{}{}", num, match (num % 10, num % 100) {
(1, 11) => "th",
(1, _) => "st",
(2, 12) => "th",
(2, _) => "nd",
(3, 13) => "th",
(3, _) => "rd",
_ => "th"
})
}
fn main() {
let ranges = vec![
(0i, 26i),
(250i, 266i),
(1000i, 1026i)
];
for &(s, e) in ranges.iter() {
println!("[{}, {}) :", s, e);
for i in range(s, e) {
print!("{}, ", nth(i));
}
println!("");
}
}