# Validate Leap Year in VB.NET Console

### Language

In this tutorial, i will teach you how to validate a year as leap year or not. Hence we already know that leap year has 366 days instead of the normal 365 days. Leap years occur every 4 years. And this fact is our formula in finding a leap year using the console application in vb.net. Now, let's start this tutorial! 1. Let's start with creating a Console Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Console Application. 2. Name your project as LeapYear as your module. Note: This is a console application so we cannot have visual controls for this tutorial. 3. Add the following code in your module.
`Module LeapYear    Sub main()`
Initialize variable yeear as Integer and make it input as your inputted year.
`        Dim yeaar As Integer        Console.Write("Enter Year:")        yeaar = CInt(Console.ReadLine())`
Make an If Else Statement because we all know that leap year has an exception that every 100 years special rules apply and will be a leap year. For example 1900 was not a leap year, but 2000 was. We used the Mod operator to find the remainder of your inputted year divided by 100 that is not equal to 0. Then, after that filter again the year that a leap year will occur in every 4 years because of February 29. Otherwise, it is not a leap year.
`         If yeaar Mod 100 <> 0 Then            If yeaar Mod 4 = 0 Then                Console.WriteLine(yeaar & " is a Leap year")            Else                Console.WriteLine(yeaar & " is NOT a Leap year")            End If`
Next, if 100 multiplied by 4 years and that is 400 it will be a leap year. Otherwise, not. This is an else statement that is not equal to the 100 years that leap years special rule is applied.
`        Else            If yeaar Mod 400 = 0 Then                Console.WriteLine(yeaar & " is a Leap year")            Else                Console.WriteLine(yeaar & " is NOT a Leap year")            End If        End If        Console.ReadLine()    End SubEnd Module`
Output: Best Regards, Engr. Lyndon R. Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer If you have some queries, feel free to contact the number or e-mail below. Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Visit and like my page on Facebook at: https://www.facebook.com/BermzISware Add and Follow me on Facebook: https://www.facebook.com/donzzsky

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.