Leap Year Program in C#

A year containing an extra day. It has 366 days instead of the normal 365 days. The extra day is added in February, which has 29 days instead of the normal 28 days. Leap years occur every 4 years. 2016 is a leap year and so is 2020.

Program of leap year in c# console application


    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace ConsoleApplication1
    {
      class Program
      {
          static void Main(string[] args)
         {
              int leap;
              Console.WriteLine("ENTER THE YEAR :- ");
              leap = Convert.ToInt32(Console.ReadLine());
              if (leap % 4 == 0 || leap % 400 == 0)
              {
                  Console.WriteLine("ENTER YEAR IS LEAP YEAR.");
              }
              else
              {
                 Console.WriteLine("ENTER YEAR IS NOT LEAP YEAR.");
              }
             Console.ReadLine();
          }
      }
   }
	

Output

	
   ENTER THE YEAR :- 2016
   ENTER YEAR IS LEAP YEAR.
           

Post Your Comment