Skip to content

Instantly share code, notes, and snippets.

@nidhi-canopas
Created July 1, 2022 19:05
Show Gist options
  • Select an option

  • Save nidhi-canopas/0d1f89f765e86afa40efe9e329f77cc3 to your computer and use it in GitHub Desktop.

Select an option

Save nidhi-canopas/0d1f89f765e86afa40efe9e329f77cc3 to your computer and use it in GitHub Desktop.
func IsLeapYear(year int) bool {
return year%4 == 0 && year%100 != 0 || year%400 == 0
}
/* check for leap year */
fmt.Println("2020 is leap year: ", IsLeapYear(2020))
//output:
2020 is leap year: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment