怎样用VB编一个程序,要求输入一个年份,判断出是否为闰年?

2024-11-17 06:36:05
推荐回答(1个)
回答1:

Dim yea As Integer
Dim LeapYear As Boolean
yea = InputBox("请输入年号:")
If ((yea Mod 4) = 0) Then
LeapYear = ((yea Mod 100) > 0) Or ((yea Mod 400) = 0)
End If
If LeapYear Then MsgBox yea & "年是闰年。" Else MsgBox yea & "不是闰年"