VB编写2程序
来源:百度知道 编辑:UC知道 时间:2024/06/05 01:00:34
3 3 3
153= 1 +5 +3
2。编写一程序,输出从2003到2050年之间的所有闰年(就是能被4整除但不能被100整除的年份,单要注意能被400整除的也是闰年)
把打字再练习一下.
比较简单,但是得现做,没有时间啦.
还不给分.
vb水仙花数
Dim aa As Integer, bb As Integer, cc As Integer
Dim abc As Integer, sabc As String, allabc(900) As Integer
Dim ii As Integer
Private Sub Form_Load()
Call main1
Call show1
Me.Caption = CStr(allabc(3))
End Sub
Function main1()
For i = 100 To 999
abc = i
aa = CInt(Left(CStr(abc), 1)): bb = CInt(Mid(CStr(abc), 2, 1)): cc = CInt(Right(CStr(abc), 1))
If abc = aa ^ 3 + bb ^ 3 + cc ^ 3 Then
allabc(ii) = abc: ii = ii + 1
End If
Next i
'ReDim Preserve allabc(ii)
End Function
Function show1()
For i = 0 To ii
Me.Print CStr(allabc(i)) + Chr(13)
Next i
End Function
所有闰年
for s=2003 to 2050
If s Mod 400 = 0 Or (s Mod 4 = 0 And s Mod 100 <> 0) Then
label1.text=label1.text & s & " "
Else
End If
next
我们要养成一个良好的用vb.ne