1个回答
展开全部
Private Sub Command1_Click()
Dim a(1 To 10) As Single '这里假定输入10个数
Dim Fcount As Integer, Zcount As Integer
Dim i%
For i = 1 To 10
a(i) = InputBox("输入")
Next
For i = 1 To 10
If a(i) > 0 Then z = z + a(i)
If a(i) < 0 Then f = f + a(i)
Next
For i = 1 To 10
If a(i) > 0 Then Zcount = Zcount + 1
If a(i) < 0 Then Fcount = Fcount + 1
Next
Print "整数之和:" & z
Print "负数之和:" & f
Print "正数个数:" & Zcount
Print "负数个数:" & Fcount
End Sub
正在码字 请稍等
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询