Ad
Code
Diff
  • using System;
    
    public class LeapYears
    {
      // A leap year is any year that's divisible by 4 EXCEPT for years that're both divisible by 100 and not divisible by 400.
      public static bool IsLeapYear(int year) => year % 400 == 0 || year % 100 != 0 && year % 4 == 0;
    }
    • using System;
    • public class LeapYears
    • {
    • public static bool IsLeapYear(int year)
    • {
    • return year % 400 == 0 || year % 100 != 0 && year % 4 == 0;
    • }
    • // A leap year is any year that's divisible by 4 EXCEPT for years that're both divisible by 100 and not divisible by 400.
    • public static bool IsLeapYear(int year) => year % 400 == 0 || year % 100 != 0 && year % 4 == 0;
    • }