fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static bool isLeapYear(int year)
  6. {
  7. bool res = false;
  8. if (year % 4 == 0)
  9. {
  10. if ((year % 100 != 0) || ((year % 100 == 0) && (year % 400 == 0)))
  11. {
  12. res = true;
  13. }
  14. }
  15. return res;
  16. }
  17.  
  18. public static void Main()
  19. {
  20. Console.WriteLine(isLeapYear(2016));
  21. Console.WriteLine(isLeapYear(2018));
  22. }
  23. }
Success #stdin #stdout 0.02s 15752KB
stdin
Standard input is empty
stdout
True
False