Pages

Search This Blog

Leap Year Checking


Module LeapYear
    Sub main()
        Dim y As Integer
        Console.Write("Enter Year:")
        y = CInt(Console.ReadLine())
        If y Mod 100 = 0 Then
            If y Mod 400 = 0 Then
                Console.WriteLine("The year is a Leap year")
            Else
                Console.WriteLine("The year is NOT a Leap year")
            End If
        Else
            If y Mod 4 = 0 Then
                Console.WriteLine("The year is a Leap year")
            Else
                Console.WriteLine("The year is NOT a Leap year")
            End If
        End If
        Console.ReadLine()
    End Sub
End Module

7 comments: