June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
9
Task/Leap-year/Visual-Basic/leap-year-1.vb
Normal file
9
Task/Leap-year/Visual-Basic/leap-year-1.vb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Public Function IsLeapYear1(ByVal theYear As Integer) As Boolean
|
||||
'this function utilizes documented behaviour of the built-in DateSerial function
|
||||
IsLeapYear1 = (VBA.Day(VBA.DateSerial(theYear, 2, 29)) = 29)
|
||||
End Function
|
||||
|
||||
Public Function IsLeapYear2(ByVal theYear As Integer) As Boolean
|
||||
'this function uses the well-known formula
|
||||
IsLeapYear2 = IIf(theYear Mod 100 = 0, theYear Mod 400 = 0, theYear Mod 4 = 0)
|
||||
End Function
|
||||
7
Task/Leap-year/Visual-Basic/leap-year-2.vb
Normal file
7
Task/Leap-year/Visual-Basic/leap-year-2.vb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Sub Main()
|
||||
'testing the above functions
|
||||
Dim i As Integer
|
||||
For i = 1750 To 2150
|
||||
Debug.Assert IsLeapYear1(i) Eqv IsLeapYear2(i)
|
||||
Next i
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue