lundi 7 septembre 2015

Java Coding; Leap Year or Not a Leap Year

Write a java program to compute leap year. To determine is a year is a leap year, use the following logic:

  • The year must be divisible by 4.
  • Starting from 1582, if the year is divisible by 100, it must also be divisible by 400. Thus, the year 1700 is not a leap year, but 2000 is. However, 1500 is leap year since it was before 1582, the adoption year of Gregorian calendar.

(Note: I am using java.util.Scanner; and if else statements.)

Aucun commentaire:

Enregistrer un commentaire