Write a console application that prints the next 20 leap years. A leap year is a year in
which an extra day is added to the Gregorian calendar, which is used by most of the
world. While an ordinary year has 365 days, a leap year has 366 days. ... A leap year
comes once every four years. Because of this, a leap year can always be evenly
divided by four
Module Module1
Sub Main()
Console.Write("Enter the current year: ")
Dim yearNow As Integer = Integer.Parse(Console.ReadLine())
Console.WriteLine("The next 20 leap years are: ")
Dim leapYears As Integer = 0
Do While leapYears < 20
If (yearNow Mod 4 = 0) Then
Console.WriteLine("The year " + yearNow.ToString() + " is a leap.")
leapYears += 1
End If
yearNow += 1
Loop
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment