Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

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

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