Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!

# Java 3 Leap

Bob Beasley
Greenhorn
Posts: 5
I don't understand this one. Year 2000 is / 4 but your next 2 rules would exclude it from being a leap year?
Thanks
Bob
Write a program that will read in a year and report if it is a leap year. The tricky thing here is that a leap year occurs:
on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
except every year that is evenly divisible by 400.
In other words, I want to type
java Leap 2000

and see
leap year!

Marilyn de Queiroz
Sheriff
Posts: 9063
12
If you search (at the top of the page under the Post New Topic/Post Reply buttons) for "leap year" in this forum, you'll find quite a few threads like this one regarding this very same question.

This question does not have a succinct one-statement-fits-everyone's-understanding type answer. You're probably better off reading the multiple replies you'll find in the search. However, if it still doesn't make sense, we'll try again to explain it, because you can't very well do the assignment without understanding the algorithm.

By the way, welcome to the Cattle Drive
[ November 06, 2002: Message edited by: Marilyn de Queiroz ]

Barry Gaunt
Ranch Hand
Posts: 7729
From "High-Tech Dictionary":
Leap years fall on any year that either can be evenly divided by 400 or evenly divided by 4 and not evenly divided by 100.For example, the year 2000 is a leap year, but 1900 is not.

From "Cisco Year 2000 Compliance Definition:"
Leap Year occurs in all years divisible by 400 or evenly divisible by 4 and not evenly divisible by 100. For example, 1996 is a Leap Year since it is divisible by 4 and not evenly divisible by 100. The year 2000 is a Leap Year since it is divisible by 400.