早教吧 育儿知识 作业答案 考试题库 百科 知识分享

表达式(x-2)!+(x-3)!+······+(x-N)!,N,X分别输入到2个文本框中,请高手看看我的程序什么地方错了z=0s=1N=Val(Text1.Text)x=Val(Text2.Text)Fori=1ToN-1Doi=i+1m=x-is=m*sLoopWhilem=1z

题目详情
表达式(x-2)!+(x-3)!+······+(x-N)!,N,X分别输入到2个文本框中,请高手看看我的程序什么地方错了
z = 0 s = 1 N = Val(Text1.Text) x = Val(Text2.Text) For i = 1 To N - 1 Do i = i + 1 m = x - i s = m * s Loop While m = 1 z = z + s Next i Label4.Caption = Str(z)
▼优质解答
答案和解析
一段时间没看VB了,你试试这段.Private Sub Command1_Click() Dim m As Long,n As Long,f As Long x = Val(Text1.Text) n = Val(Text2.Text) If x < n Then '判断,如果x