Private Sub Command1_Click()
Dim i,n,s As Integer
n = Val(Text1.Text)
s = 0
For i = n To 0 Step -1
s = s + i * (i + 1) / 2
Next i
Text2.Text = s
End Sub
VB程序输入整数N,计算前N项和S=1+(1+2)+(1+2+3)+(1+2+3+4)+….
VB程序输入整数N,计算前N项和S=1+(1+2)+(1+2+3)+(1+2+3+4)+….
其他人气:189 ℃时间:2020-10-02 00:50:33
优质解答
我来回答
类似推荐
猜你喜欢
- 1已知√3sinα-cosα=4m-6(0<α<π),求m的取值范围
- 2请问:the literature of knowledge and the literature of power怎么译
- 3一个长100m宽60m的游泳池扩建成一个周长为600m的大型水上游乐场,把游泳池的长增加xm,那么x等于多少时,水上游乐场的面积为20000m2?列出方程_,能否求出x的值:_(能或不能).
- 4英语翻译
- 5英文字母拼单词
- 6分组分解法的一道题
- 7跟祖父学诗阅读答案
- 8season the of year autumm is third (.) the 11th is November of month year the (.) 连词成句
- 9黄果树瀑布的声音真大__________________
- 10硅酸钠溶液中加入稀盐酸,求方程式