Leap Year

Write a program which will ask for a starting year and an ending year, and then puts all of the leap years between them (and including them, if they are also leap years). Leap years are years divisible by four (like 1984 and 2004). However, years divisible by 100 are not leap years (such as 1800 and 1900) unless they are divisible by 400 (like 1600 and 2000, which were in fact leap years). 

screen-shot-2016-10-26-at-9-38-32-pm

Ran the program with years 1600 – 2000 and this is the results:

Enter the starting year:

>> 1600

Enter the ending year:

>> 2000

Here are the leap years:

1600

1604

1608

1612

1616

1620

1624

1628

1632

1636

1640

1644

1648

1652

1656

1660

1664

1668

1672

1676

1680

1684

1688

1692

1696

1704

1708

1712

1716

1720

1724

1728

1732

1736

1740

1744

1748

1752

1756

1760

1764

1768

1772

1776

1780

1784

1788

1792

1796

1804

1808

1812

1816

1820

1824

1828

1832

1836

1840

1844

1848

1852

1856

1860

1864

1868

1872

1876

1880

1884

1888

1892

1896

1904

1908

1912

1916

1920

1924

1928

1932

1936

1940

1944

1948

1952

1956

1960

1964

1968

1972

1976

1980

1984

1988

1992

1996

2000

Advertisements
Leap Year

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s