急求VB程序改错题高手,每个FOUND下一行有错误,请改正!十万火急!
'题目:已知C的公式表示如下:'n!'C=------------------'(n-m)!*m!'函数过程fac()求k!函数,在Fomr_Click事件中完成运算,'...
'题目:已知C的公式表示如下:
' n!
' C=------------------
' (n-m)!*m!
'函数过程fac( )求k!函数,在Fomr_Click事件中完成运算,
'请修正程序中错误。
'------------------------------------------------
Option Explicit
Private Function fac(k As Integer) As Single
Dim x As Single, j As Integer
'**********FOUND**********
x = 0
For j = 1 To k
'**********FOUND**********
x = x ^ j
Next j
fac = x
End Function
Private Sub Form_Click()
Dim C As Single
Dim m As Integer, n As Integer
m = Val(InputBox("请输入一个整数(m):"))
n = Val(InputBox("请输入一个整数(n):"))
'**********FOUND**********
C = fac(n) / fac(n - m) * fac(m)
Print "C="; C
End Sub 展开
' n!
' C=------------------
' (n-m)!*m!
'函数过程fac( )求k!函数,在Fomr_Click事件中完成运算,
'请修正程序中错误。
'------------------------------------------------
Option Explicit
Private Function fac(k As Integer) As Single
Dim x As Single, j As Integer
'**********FOUND**********
x = 0
For j = 1 To k
'**********FOUND**********
x = x ^ j
Next j
fac = x
End Function
Private Sub Form_Click()
Dim C As Single
Dim m As Integer, n As Integer
m = Val(InputBox("请输入一个整数(m):"))
n = Val(InputBox("请输入一个整数(n):"))
'**********FOUND**********
C = fac(n) / fac(n - m) * fac(m)
Print "C="; C
End Sub 展开
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
单片机汇编程序是用汇编语言编写的程序,用于控制单片机的操作。汇编语言是一种比较接近计算机硬件语言的低级语言,相对于高级语言来说更容易理解和实现。下面是单片机汇编程序的基本步骤:1. 将代码和数据汇编到规定的段中。2. 在存储器中用未初始化的...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
展开全部
Option Explicit
Private Function fac(k As Integer) As Single
Dim x As Single, j As Integer
'**********FOUND**********
x = 1
For j = 1 To k
'**********FOUND**********
x = x * j
Next j
fac = x
End Function
Private Sub Form_Click()
Dim C As Single
Dim m As Integer, n As Integer
m = Val(InputBox("请输入一个整数(m):"))
n = Val(InputBox("请输入一个整数(n):"))
'**********FOUND**********
C = fac(n) / (fac(n - m) * fac(m))
Print "C="; C
End Sub
Private Function fac(k As Integer) As Single
Dim x As Single, j As Integer
'**********FOUND**********
x = 1
For j = 1 To k
'**********FOUND**********
x = x * j
Next j
fac = x
End Function
Private Sub Form_Click()
Dim C As Single
Dim m As Integer, n As Integer
m = Val(InputBox("请输入一个整数(m):"))
n = Val(InputBox("请输入一个整数(n):"))
'**********FOUND**********
C = fac(n) / (fac(n - m) * fac(m))
Print "C="; C
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询