Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Leap-year/Swift/leap-year.swift
Normal file
7
Task/Leap-year/Swift/leap-year.swift
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
func isLeapYear(year: Int) -> Bool {
|
||||
return year.isMultiple(of: 100) ? year.isMultiple(of: 400) : year.isMultiple(of: 4)
|
||||
}
|
||||
|
||||
[1900, 1994, 1996, 1997, 2000].forEach { year in
|
||||
print("\(year): \(isLeapYear(year: year) ? "YES" : "NO")")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue