永发信息网

VB6 用for循环 求等差数列的 和 与 积

答案:1  悬赏:50  手机版
解决时间 2021-03-21 04:57
  • 提问者网友:孤凫
  • 2021-03-20 16:23
VB6 用for循环 求等差数列的 和 与 积
最佳答案
  • 五星知识达人网友:冷風如刀
  • 2021-03-20 17:57
Private Sub Command1_Click()
Dim a As Integer, b As Integer
Dim c As Integer, d As Double, i As Integer
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = 0
For i = a To b Step c
d = d + i
Next i
Label1.Caption = "和=" & d
End Sub

Private Sub Command2_Click()
Dim a As Integer, b As Integer
Dim c As Integer, d As Double, i As Integer
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = 1
For i = a To b Step c
d = d * i
Next i
Label1.Caption = "积=" & d
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯