year=val(inputbox("输入年份"))
if (year mod 4=0 and year mod 100 <>0 ) or year mod 400=0 then
msgbox "是闰年"
else
msgbox "不是闰年"
end if
Dim yea As IntegerDim 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 &"不是闰年"
Private Sub Command1_Click()Dim x%, m%
x = Val(Text1.Text)
Select Case x Mod 4
Case Is <>0
Print "x" &"不是闰年"
Case 0, x Mod 100 <>0
Print "x" &"是闰年"
Case 0, x Mod 100 = 0, x Mod 400 <>0
Print "x" &"不是闰年"
Case 0, x Mod 100 = 0, x Mod 400 = 0
Print "x" &"是闰年"
End Select
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)