fix: if leap year exercise
This commit is contained in:
@ -22,6 +22,9 @@ package main
|
|||||||
// go run main.go 2018
|
// go run main.go 2018
|
||||||
// 2018 is not a leap year.
|
// 2018 is not a leap year.
|
||||||
//
|
//
|
||||||
|
// go run main.go 2100
|
||||||
|
// 2100 is not a leap year.
|
||||||
|
//
|
||||||
// go run main.go 2019
|
// go run main.go 2019
|
||||||
// 2019 is not a leap year.
|
// 2019 is not a leap year.
|
||||||
//
|
//
|
||||||
|
@ -34,6 +34,8 @@ func main() {
|
|||||||
var leap bool
|
var leap bool
|
||||||
if year%400 == 0 {
|
if year%400 == 0 {
|
||||||
leap = true
|
leap = true
|
||||||
|
} else if year%100 == 0 {
|
||||||
|
leap = false
|
||||||
} else if year%4 == 0 {
|
} else if year%4 == 0 {
|
||||||
leap = true
|
leap = true
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user