Private Sub Command1_Click()
Dim s As Double, n As Integer, i As Integer
s = 1
n = InputBox("请输入数据")
For i = 1 To n
s = s * i
Next i
Print s
End Sub
要用条件循环编程!
追答你又问的什么,我怎么看不到,能不能先采纳我的答案!
要用条件循环编程,就是do while。 loop
本回答被网友采纳用VB编程算1*2*3*...*n
Private Sub Command1_Click() Dim s As Double, n As Integer, i As Integer s = 1 n = InputBox("请输入数据") For i = 1 To n s = s * i Next i Print sEnd Sub
求vb高手编程,设n=1*2*3...*n,求不大于20000时最大的n
x = 1 For n = 1 To 20000 y = n * y If y >= 20000 Then Exit For End If Next n MsgBox y MsgBox n For n = n - 1 To 1 Step -1 x = n * x Next n MsgBox x
vb中1乘2乘3乘4……乘n怎么表示?
Private Sub Form_Click() '点击窗体开始运行Dim n As Integer, i As Integer, s As Doublen = Val(InputBox("请输入一个大于1的整数n"))s = 1For i = 2 To n s = s * iNextMsgBox n & "!的值为" & sEnd Sub
利用VB条件循环(do while...loop)编程,求1*2*3*4...n的值
Do While (n > 0)i = i * n n = n - 1 Loop Print i End Sub
...3!时进行调用。提示:阶乘计算公式n!=1*2*3...*n
long pow(long n){ long i,p=1;for (i=1;i<=n;i++) p*=i;return p;} main(){ long x;x=pow(7)+pow(4)-pow(3);printf("%ld\\n",x);}
计算1*2*3*...*N N通过inputbox语句输入通过msgbox输出vb.net的程序
dim n as int32=int(inputbox.text.trim())dim m as int32=1 for i as int32 =1 to n m=m*i next messagebox.show(m.tostring())纯手工,可能有点错误
怎么写vb的阶乘代码
1、For语句实现 Private Sub Command1_Click()Dim s As Long, n As Integer, i As Integer n = Val(Text1.Text)s = 1 For i = 1 To n s = s * i Next i Label4.Caption = Str(s)End Sub 2、Do While语句实现 Private Sub Command1_Click()Dim s As Long, n As Integer, ...
有懂用VB中的DO 或FOR语句 做1!*2!*3!...50!的程序? 帮忙做一下
编程是可以编可是不能运行呀 因为结果太大了 超出了VB数据类型(Double)的范围了都 如果是要代码的话 请看下面的 Private Sub Form_Click()Dim a As Double a = 1 b = 1 For i = 1 To 50 For j = 1 To i b = b j Nexb j a = a b b = 1 Nexb i MagBox a End Sub ...
利用vb语言编写数值类算法1*2*3*4*5,即为5!
试试如下 这段 子程序:Sub 计算阶乘()阶乘 = 1 i = InputBox("写入一个正整数")For x = 1 To i 阶乘 = 阶乘 * x Next x MsgBox i & "!=" & 阶乘 End Sub 输出结果:
vb编程求1*2*3*...*10
dim i as integer,n as integer i=1:n=1 while i<=10 n=n*i i=i+1 wend debug.print "10的阶乘是:",i