C# Program to Check Leap Year

In this C# program, we will take the input from the user and check whether the input year is a Leap Year or not. Leap year is a year which is divisible by 4.

C# Program to Check Leap Year Code:

private static void Main(string[] args)
        {
            Console.Write("Enter a year: ");
            int year = int.Parse(Console.ReadLine());
            if (year % 4 == 0)
            {
                Console.WriteLine("Entered year {0} is a leap year.", year);
            }
            else
            {
                Console.WriteLine("Entered year {0} is not a leap year.", year);
            }

            Console.ReadLine();
        }

C# Program to Check Leap Year Output:

CSharp-Program-to-Check-Leap-Year

CSharp-Program-to-Check-Leap-Year
 

 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice