Answer to Question #187989 in Visual Basic for Olivia

Question #187989

How do I add comments To 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.


1
Expert's answer
2021-05-01T23:31:48-0400
Module Module1


    Sub Main()
        Console.Write("Enter year: ")
        Dim year As Integer = Integer.Parse(Console.ReadLine())
        Console.WriteLine("The next 20 leap years are: ")
        Dim numberOfLeapYears As Integer = 0
        Do
            If (year Mod 4 = 0) Then
                Console.Write(year.ToString() + " ")
                numberOfLeapYears += 1
            End If
            year += 1
        Loop While numberOfLeapYears < 20
        Console.ReadLine()
    End Sub


End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS