欢迎访问服务器技术网-www.fuwuqijishu.com

VB编S=113

程序设计 fuwuqijishu 2年前 (2022-10-01) 22次浏览 0个评论 扫描二维码

关于VB编S=1-1/3!+1/5!-1/7…..人脑进入死循环…Private Sub Command1_Click()
Dim n As Integer, i As Integer, s As Integer, p As Integer, j As Integer
n = Val(Text1.Text)
s = 1
p = 1
For i = 2 To (2 * n – 1) Step 1
p = p * (2 * i – 2) * (2 * i – 1)
j = (-1) ^ (i – 1)
s = s + j * (1 / p)
Next i
Text2.Text = Str(s)
End Sub

VB计算S=1-1/3!+1/5!-1/7!+…….+(-1)^(n+1)* 1/(2n-1)!
小弟是学生,在学VB,这代码有什么错误,帮忙看一下。。。。。的问题

这样改下看行吗!~
n = Val(Text1.Text)
s = 1
p = 1
If n

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

Warning: error_log(/www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/#log/log-2412.txt): failed to open stream: No such file or directory in /www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/spider.class.php on line 2900