Check if specified year is a leap year in CSharp
Description
The following code shows how to check if specified year is a leap year.
Example
//from w ww . ja v a 2 s. c om
using System;
public class IsLeapYear
{
public static void Main()
{
for (int year = 1994; year <= 2014; year++)
{
if (DateTime.IsLeapYear(year))
{
Console.WriteLine("{0} is a leap year.", year);
}
}
}
}
The code above generates the following result.