Skip to content

Megscode/leap_year

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A simple tool that will tell you whether a year is a leap year, according to the following rules:

DONE All years divisible by 400 ARE leap years (e.g. 2000 was a leap year)

DONE All years divisible by 100 but not by 400 are NOT leap years (e.g. 1700, 1800 and 1900 were not leap years)

DONE All years divisible by 4 and not by 100 ARE leap years (e.g. 2004, 2008 and 2012 were leap years)

DONE All years not divisible by 4 are NOT leap years (e.g. 2009, 2010 and 2011 were not leap years)

Example output

2.4.1 :001 > require './lib/leap_years.rb' => true 2.4.1 :002 > leap_year?(2000) => true 2.4.1 :003 > leap_year?(1970) => false 2.4.1 :004 > leap_year?(1900) => false 2.4.1 :005 > leap_year?(1988) => true 2.4.1 :006 > leap_year?(1500) => false

input output

2000 true

2001 false

1988 true

1 false

Two-thousand error

leap_year?(2000) true

leap_year?(1970) false

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages