Checking for Leap year in C#

Checking for Leap year in C#

using System;

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Checking for Leap year in C#\n");
        Console.WriteLine("Enter the year");
        int year = Convert.ToInt32(Console.ReadLine());
        if (DateTime.IsLeapYear(year))
            Console.WriteLine("Leap Year");
        else
            Console.WriteLine("Not a Leap Year");
    }
}
DEMO
Checking for Leap year in C# Checking for Leap year in C# Reviewed by Bhaumik Patel on 8:41 AM Rating: 5