From afed907fb3e6d1920d93ba5975836757fb4b22ad Mon Sep 17 00:00:00 2001 From: Inanc Gumus Date: Tue, 13 Nov 2018 10:45:55 +0300 Subject: [PATCH] fix: if leap year exercise --- 11-if/exercises/07-leap-year/main.go | 3 +++ 11-if/exercises/07-leap-year/solution/main.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/11-if/exercises/07-leap-year/main.go b/11-if/exercises/07-leap-year/main.go index b290c64..b96e8ba 100644 --- a/11-if/exercises/07-leap-year/main.go +++ b/11-if/exercises/07-leap-year/main.go @@ -22,6 +22,9 @@ package main // go run main.go 2018 // 2018 is not a leap year. // +// go run main.go 2100 +// 2100 is not a leap year. +// // go run main.go 2019 // 2019 is not a leap year. // diff --git a/11-if/exercises/07-leap-year/solution/main.go b/11-if/exercises/07-leap-year/solution/main.go index fa0c780..13485ca 100644 --- a/11-if/exercises/07-leap-year/solution/main.go +++ b/11-if/exercises/07-leap-year/solution/main.go @@ -34,6 +34,8 @@ func main() { var leap bool if year%400 == 0 { leap = true + } else if year%100 == 0 { + leap = false } else if year%4 == 0 { leap = true }