snrg.net
当前位置:首页 >> vB求 1+2+3+n 当和大于10000时n 的值 >>

vB求 1+2+3+n 当和大于10000时n 的值

dim sum,n sum=0 n=0 do until sum>10000 n=n+1 sum=sum+n loop msgbox n

private sub form_click() a = 0 b = 0 do while b <= 10000 a = a + 1 b = b + a loop print a print b end sub

Private Sub Command1_Click() Dim n As Integer n = 1 Dim M As Single M = 1 Do While M 评论0 0 0

dim a as integer,b as integer n=val(text1.text)do while a>=1b=b+aa=a+1if a>n then exit doloop label1.caption="1+2+3……+n="&b dim a as interger, b as integern=val(text1.text)dob=b+aa=a+1loopuntil a=n

Private Sub Command1_Click() Dim i As Integer, j As Integer, m As Long, n As Long i = 1 Do While n <= 10000 m = 1 For j = 1 To i m = m * j Next Print m n = n + m i = i + 1 Loop Print i-1, n End Sub

Sub s() k = 1 Do While n < 10000 i = i + 1 k = k * i n = n + k Loop MsgBox iEnd Sub

Private Sub Command1_Click()Dim nn = Val(InputBox("n="))jc = 1For i = 1 To n jc = jc * i Sum = Sum + jcNext iMsgBox SumEnd Sub

Sub Test() Dim n As Integer Dim i As Integer Dim sum As Integer n = InputBox("请输入:") sum = 0 For i = 1 To n sum = sum + i Next i MsgBox(sum)

Private Sub Form_Click() n = 1 Do Until Sum > 10000 j = 1 For i = 1 To n j = j * i Next n = n + 1 Sum = Sum + j Loop Print n - 1 End Sub

Private Sub Command1_Click() 和 = 0 n = 0 Do 和 = 和 + n n = n + 1 Loop Until 和 > 10000 MsgBox "加到" & n & "时,超过了10000,达到" & 和End Sub

相关文档
网站首页 | 网站地图
All rights reserved Powered by www.snrg.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com