rust: leap

This commit is contained in:
2020-08-20 21:54:50 -04:00
parent f48a042ef8
commit 55a3854cbd
5 changed files with 230 additions and 0 deletions

9
rust/leap/src/lib.rs Normal file
View File

@ -0,0 +1,9 @@
pub fn is_leap_year(year: u64) -> bool {
if year % 400 == 0 {
true
} else if year % 100 == 0 {
false
} else {
year % 4 == 0
}
}