用vb编写程序,计算s=1+(1+2)+(1+2+3)+...+(1+2+3+...+n)的值
用vb编写程序,计算s=1+(1+2)+(1+2+3)+...+(1+2+3+...+n)的值...
用vb编写程序,计算s=1+(1+2)+(1+2+3)+...+(1+2+3+...+n)的值
展开
1个回答
2016-05-05
展开全部
Private Sub Command1_Click()Dim n As IntegerDim sum As DoubleDim Tsum As IntegerTsum = 0sum = 0n = InputBox("请输入数字N")For i = 1 To n Tsum = Tsum + i sum = sum + TsumNext iPrint sumEnd Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询