作业帮 > 综合 > 作业

Private Sub Command1_Click() Dim i As Integer,s As Integer,n

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/14 18:47:25
Private Sub Command1_Click() Dim i As Integer,s As Integer,n As Integer
Private Sub Command1_Click()
Dim i As Integer,s As Integer,n As Integer
n = Val(Text1.Text)
s = o
For i = 1 To n
s = s + i \ 4
Next i
Label1.Caption = Str(s)
End Sub
Text1中输入8单击command1 label上显示什么?
i=1 s=s+i\4=0+1\4=0+0=0
i=2 s=s+i\4=0+2\4=0+0=0
i=3 s=s+i\4=0+3\4=0+0=0
i=4 s=s+i\4=0+4\4=0+1=1
i=5 s=s+i\4=1+5\4=1+1=2
i=6 s=s+i\4=2+6\4=2+1=3
i=7 s=s+i\4=3+7\4=3+1=4
i=8 s=s+i\4=4+8\4=4+2=6
所以Label1上显示的是 6