编程输出十个数中所有负数并求负数和
答案:1 悬赏:30 手机版
解决时间 2021-03-08 17:25
- 提问者网友:謫仙
- 2021-03-07 17:16
编程输出十个数中所有负数并求负数和
最佳答案
- 五星知识达人网友:北城痞子
- 2021-03-07 17:36
Private Sub Form_Load()
Show
Dim s1 As String
Dim s2() As String
Dim i As Long
Dim sz As String
Dim sf As String
s1 = InputBox("请输入十个数,用空格分割")
s2 = Split(s1, " ")
For i = LBound(s2) To UBound(s2)
If CLng(s2(i)) < 0 Then "小于0则表示为负数
sf = sf + CStr(s2(i)) + " "
Else "正数
sz = sz + CStr(s2(i)) + " "
End If
Next i
Print "其中的正数有:"; sz
Print "其中的负数有:"; sf
End Sub
Show
Dim s1 As String
Dim s2() As String
Dim i As Long
Dim sz As String
Dim sf As String
s1 = InputBox("请输入十个数,用空格分割")
s2 = Split(s1, " ")
For i = LBound(s2) To UBound(s2)
If CLng(s2(i)) < 0 Then "小于0则表示为负数
sf = sf + CStr(s2(i)) + " "
Else "正数
sz = sz + CStr(s2(i)) + " "
End If
Next i
Print "其中的正数有:"; sz
Print "其中的负数有:"; sf
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯