Function fun(a As Integer,n As Integer) As Integer
来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/11/09 10:22:33
Function fun(a As Integer,n As Integer) As Integer
Dim m As Integer
While a >= n
a = a - n
m = m + 1
Wend
fun = m
End Function
该函数的返回值是__
能给说明白点原因吗?
Dim m As Integer
While a >= n
a = a - n
m = m + 1
Wend
fun = m
End Function
该函数的返回值是__
能给说明白点原因吗?
可以理解为 a mod n ,整除
---补充说明如下---------------
2个数,a和n,只要a>n就循环a-n,计算减了几次累计放在m,m是个结果返回值.
比如a=15 n=4,a>n吧,a-n后 a=11 m=1再来一次,m=2,a=7,再来 m=3,a=3
现在a>n不成立,不再循环,结果m=3就是 a 整除n,15 \4的结果,整数部分.
不过这里有一些问题存在,要求a,n 都>0,如果n
---补充说明如下---------------
2个数,a和n,只要a>n就循环a-n,计算减了几次累计放在m,m是个结果返回值.
比如a=15 n=4,a>n吧,a-n后 a=11 m=1再来一次,m=2,a=7,再来 m=3,a=3
现在a>n不成立,不再循环,结果m=3就是 a 整除n,15 \4的结果,整数部分.
不过这里有一些问题存在,要求a,n 都>0,如果n
Function fun(a As Integer,n As Integer) As Integer
Dim a(9) As Integer,x As Integer,k As Integer,I As Integer R
Private Function p1(x As Integer,y As Integer,z As Integer)
Dim ia(1 To 10) As Integer,imin As Integer,n As Integer,i As
vb程序Dim a(1 To 20) As Integer,i As Integer,j As Integer
Function hw(m As Long) As Boolean Dim a As Integer,b As Inte
能不能再帮我看一道题sum Fun (a() as integer,x as integer) for i = 1 to
dim a(3,2) as integer
Private Sub Form_Click() Dim a As Integer,b As Integer,k As
Private Sub Command1_Click() Dim i As Integer,s As Integer,n
Dim i As Integer,n As Integer For i = 0 To 50 i = i + 3 n =
VB中的Dim sum As Integer语句