mirror of
https://github.com/ArthurDanjou/exercism-rust.git
synced 2026-01-25 01:10:30 +01:00
Initial commit
This commit is contained in:
8
leap/src/lib.rs
Normal file
8
leap/src/lib.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
pub fn is_leap_year(year: u64) -> bool {
|
||||
match (year % 400, year % 100, year % 4) {
|
||||
(0, _, _) => true, // Is divisible by 400
|
||||
(_, 0, _) => false, // Is divisible by 100 and 400
|
||||
(_, _, 0) => true, // Is divisible by 4, 100 and 400
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user