要求输出所有的闰年!!VB小程序,高手帮帮忙啊~~

来源:百度知道 编辑:UC知道 时间:2024/05/17 00:30:54
先用inputbox输入开始年份和结束年份!要求输出当中的所有闰年!(闰年能被4和400整除,不能被100整除),高手帮帮忙啊!!
(用for,if 函数)

Dim a As Integer, b As Integer, i As Integer, n As Integer
Private Sub Command1_click()
a = Val(InputBox("请输入开始年份"))
b = Val(InputBox("请输入结束年份"))
For i = a To b
If i Mod 4 = 0 And i Mod 100 <> 0 Then
Print i;
n = n + 1
If n Mod 5 = 0 Then Print
End If
Next i
End Sub

a=inputbox("请输入开始年份")
b=inputbox("请输入结束年份")
for i=a to b
if (i mod 4=0) and (i mod 400=0) then
print i;"是闰年。"
elseif (i mod 4=0) and (i mod 100<>0) then
print i;"是闰年。"
end if
next i

a=inputbox("请输入开始年份","提示")
b=inputbox("请输入结束年份","提示")
for i=a to b
if i mod 4=0 or i mod 400 =0 and i mod 100 <>0 then
print i
end if
next

Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim i As Integer