leap

package
v0.0.0-...-1c03fbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2016 License: MIT Imports: 0 Imported by: 0

README

Leap

Write a program that will take a year and report if it is a leap year.

The tricky thing here is that a leap year in the Gregorian calendar occurs:

on every year that is evenly divisible by 4
  except every year that is evenly divisible by 100
    unless the year is also evenly divisible by 400

For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap year, but 2000 is.

If your language provides a method in the standard library that does this look-up, pretend it doesn't exist and implement it yourself.

Notes

For a delightful, four minute explanation of the whole leap year phenomenon, go watch this youtube video.

To run the tests simply run the command go test in the exercise directory.

If the test suite contains benchmarks, you can run these with the -bench flag:

go test -bench .

For more detailed info about the Go track see the help page.

Source

JavaRanch Cattle Drive, exercise 3 view source

Documentation

Overview

Package leap implements one function to discover if a year is leap or not

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLeapYear

func IsLeapYear(year int) bool

IsLeapYear take a year and returns if that year is a leap year with these rules:

on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
unless the year is also evenly divisible by 400

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL