用vb编写一个程序,判断某年是不是闰年

来源:百度知道 编辑:UC知道 时间:2024/06/26 05:07:01

Function IsLeapYearA(ByVal yr As Integer) As Boolean
If ((yr Mod 4) = 0) Then
IsLeapYearA = ((yr Mod 100) > 0) Or ((yr Mod 400) = 0)
End If
End Function

Private Sub Command1_Click()
If IsLeapYearA(Val(Text1.Text)) Then
Print Text1.Text & "年是闰年"
Else
Print Text1.Text & "年不是闰年"
End If
End Sub

Private Sub Form_Load()
Text1.Text = ""
End Sub

dim year as interger'判断是否是闰年
if (year mod 4=0 and year mod 100<>0 ) or year mod 400=0 _
then print year;"是闰年"
else print year;"不是闰年"
endif

for i=1 to 100'for循环 求1+2+……+100的和
sum = sum +i
next

垃圾