year1=InputBox("请输入年份","年份输入框")
If year1="" Then
Exit Sub
Else
year=Int(Abs(year1))
End If
If year Mod 4 = 0 And year Mod 100 <>0 Or year Mod 400 = 0 Then
MsgBox Str(year) &"年是闰年"
Else
MsgBox Str(year) &"年是平年"
End If
Sub s()y = Val(InputBox("请输入年份:"))
If y Mod 4 Then
GoTo 100
ElseIf (y Mod 100) = 0 Then
If y Mod 400 Then GoTo 100
End If
MsgBox y & "年是闰年!"
Exit Sub
100
MsgBox y & "年是平年!"
End Sub
Dim yea As Integer\x0d\x0aDim LeapYear As Boolean\x0d\x0ayea = InputBox("请输入年号:")\x0d\x0aIf ((yea Mod 4) = 0) Then\x0d\x0aLeapYear = ((yea Mod 100) >0) Or ((yea Mod 400) = 0)\x0d\x0aEnd If\x0d\x0aIf LeapYear Then MsgBox yea &"年是闰年。" Else MsgBox yea &"不是闰年"欢迎分享,转载请注明来源:内存溢出
评论列表(0条)