Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.

Commit

Permalink
LeapYear.java
Browse files Browse the repository at this point in the history
the given java program is constructed to find whether the given year is leap year or not.
  • Loading branch information
Vedantdavile committed Oct 15, 2018
1 parent 08194eb commit 13516e6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions enginnering java projects/LeapYear.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
public class LeapYear {

public static void main(String[] args) {

int year = 1900;
boolean leap = false;

if(year % 4 == 0)
{
if( year % 100 == 0)
{
// year is divisible by 400, hence the year is a leap year
if ( year % 400 == 0)
leap = true;
else
leap = false;
}
else
leap = true;
}
else
leap = false;

if(leap)
System.out.println(year + " is a leap year.");
else
System.out.println(year + " is not a leap year.");
}
}

0 comments on commit 13516e6

Please sign in to comment.