当前位置: 高中信息技术 / 填空题
  • 1. (2017·杭州模拟) 【加试题】运行下列VB程序,在文本框Text1中输入30,界面如图所示。

    单击“计算”按钮Command1后,则在文本框Text2中显示的内容是,在文本框Text3中显示的内容是

      Private Sub Command1Click()

    Dim s As Integer, t As Integer, n As Integer

    n = Val(Text1.Text)

    t = 0

    s = 0

    For i = 1 To n

         If Int(Sqr(i)) = Sqr(i) Then

            s = s + i

            t = t + 1

         End If

    Next i

    Text2.Text = Str(t)

    Text3.Text = Str(s)

    End Sub

微信扫码预览、分享更方便