The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was declared to be a leap year, with the exception of the years ending in 00 (that is those divisible by 100) and not divisible by 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800, and 1900 are not. Write a program that requests a year as input and states whether it is a leap year. (Test the program on the years 2008, 2009, 1900, and 2000.)

Respuesta :

Solution :

Public Function Is a Leap_Year(Year As_Integer) As Integer

'Dim Tor_F for local variable declaring if value is t/f.

Dim TorF As For Boolean

'Pre conditions: Year > 1581 and Year < 3000

If Year > 1581 And Year <> 1700 Or 1800 Or 1900 Then

IsLeapYear = Year / 4

Else

IsLeapYear = False

TorF = False

End If

End Function

Otras preguntas

RELAXING NOICE
Relax