Skip to content

Instantly share code, notes, and snippets.

@caelifer
Created October 13, 2015 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caelifer/b5e88e81ba20c39031bc to your computer and use it in GitHub Desktop.
Save caelifer/b5e88e81ba20c39031bc to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func IsLeapYear(y int) bool {
return y%4 == 0 && y%100 != 0 || y%400 == 0
}
func main() {
for _, i := range []int{-100, 1996, 1900, 2000, 2012} {
fmt.Println(i, IsLeapYear(i))
}
}
@caelifer
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment