1. Private Sub Command1_Click()
x = 0
n = InputBox("")
For i = 1 To n
For j = 1 To i
x = x + 1
Next j
Next i
Print x
End Sub
程序运行后,单击命令按钮,如果输入3,则在窗体上显示的内容是:
2. Private Function f(m As Integer)
If m Mod 2 = 0 Then
f = m
Else
f = 1
End If
End Function
Private Sub Command1_Click()
Dim i As Integer
s = 0
For i = 1 To 5
s = s + f(i)
Next i
Print s
End Sub
单击命令按钮后,程序的运行结果为:
1、6
2、9
2015年全国职称计算机考试教材(2007模 .. 定价:¥225 优惠价:¥213 更多书籍 | |
全国职称计算机考试速成过关系列套装:W .. 定价:¥133 优惠价:¥133.0 更多书籍 |