Answers for "Given the year input value, determine if that year was a leap year. If a number is evenly divisible by 4, but not evenly divisible by 100 then it is a leap year. coding in java"

5

leap year program in java

public static boolean isLeapYear(int year) {
  if (year % 4 != 0) {
    return false;
  } else if (year % 400 == 0) {
    return true;
  } else if (year % 100 == 0) {
    return false;
  } else {
    return true;
  }
}
Posted by: Guest on June-30-2020

Code answers related to "Given the year input value, determine if that year was a leap year. If a number is evenly divisible by 4, but not evenly divisible by 100 then it is a leap year. coding in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language