Thursday, March 12, 2015

Determine If Year Is Leap Year injava pgm



Determine If Year Is Leap Year

public class DetermineLeapYearExample
{
 public static void main(String[] args)
{
 int year = 2004;                
 if((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)))
System.out.println("Year " + year + " is a leap year");
else
System.out.println("Year " + year + " is not a leap year");
  }
}
   

No comments:

Post a Comment