设有下列函数过程 Function fun(m As Integer)As Integer Dim k As Integer,sum As Integer sum=0 For k=m To 1 Step -3 sum=sum+k Next k fun=sum End Function 若在主程序中使用语句 s=fun(9)调用此函数,则s 的值为( )。
相似题目
-
有如下函数过程: Function secproc(x As Integer, y As Integer, z As Integer) secproc = 3 * y + z + 2 * x End Function Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a = 2: b = 3: c = 4 Print secproc(c, b, a) End Sub 该程序的运行结果是( )。
-
有如下函数过程: Function F(a, b As Integer) As Integer a = b: F = a + b End Function 以下调用函数 F 的语句中,( ) 不会发生错误。
-
请问如下定义函数的代码所犯错误为:def fun_name()print('my function')
-
已定义函数Function fun(x1%,x2%) as integer,则下列调用语句正确的是()
-
执行下列程序后,输出的结果是: Function Fun1(ByVal a As Integer, b As Integer) As Integer Dim t As Integer t = a - b b = t + a Fun1 = t + b End Function Private Sub Command1_Click() Dim x As Integer x = 10 Print Fun1(Fun1(x, (Fun1(x, x - 1))), x - 1) End Sub
-
有如下函数过程:Function secproc(x As Integer, y As Integer, z As Integer)secproc = 3 * y + z + 2 * xEnd FunctionPrivate Sub Command1_Click()Dim a As Integer, b As Integer, c As Integera = 2: b = 3: c = 4Print secproc(c, b, a)End Sub该程序的运行结果是( )。
-
有如下函数过程:Function gys(ByVal x As Integer,ByVal y As Integer) As Integer Do While y<>
-
阅读程序:Function Fun(a As Integer)Static C b=0:b=b+2:c=c+2 F=a*b*cEnd FunctionPrivate S
-
设有如下通用过程:Public Sub Fun(a(),ByVal x As Integer)For i=1 To 5 x=x+a(i)NextEnd Sub在
-
设有一个命令按钮Command1的事件过程以及一个函数过程。程序如下: Private Sub Command1 Click() Static x A S Integer x=f(x+5) Cls Print X End Sub Private Function f(x As Integer)As Integer f=x+x End Function 连续单击命令按钮3次,第3次单击命令按钮后,窗体显示的计算结果是()。
-
设有以下函数过程: Function fun(a As Integer,b As Integer) Dim c As Integer If a<b The
-
设有如下通用过程:Public Sub Fun(a()As Integer,x As Integer) For i=1 To 5 x=x+a(i) Next
-
设有如下通用过程:Public Sub Fun(a(), ByVal x As Integer)For i=1 To 5x=x+a(i)NextEnd Sub在
-
设有以下函数过程:若调用函数fun时的实际参数都是自然数,则函数返回的是()
-
For the following function definition:def Fun(args):s = 0for i in args:s += ireturn sWhen calling the function “Fun(m)”, the m may be defined as ______()
-
下列程序的功能是计算两个自然数的最大公约数,界面如下图所示。给定的程序不完整,将程序补充完整。 Private Sub Command1_Click() Dim x As Long, y As Long,i As Long x=Val(Text1.Text) y=Val(Text2.Text) Text3.Text = Str(【13】 ) End Sub Function fun1(a As
-
执行下面程序,单击命令按钮CmdRun后,图片框Pic1第一行显示内容是(),第二行显示内容是(),最后一行显示内容是()。Option ExplicitPrivate Sub CmdRun_Click()Dim N As Integer,M As IntegerM=135N=8Pic1.Print Fun(M,N)EndSubPrivate Function Fun(ByVal N As Int
-
在窗体上有一个名称为Command1的命令按钮,并有如下事件过程和函数过程: Private Sub Command1_Click() Dim p as Integer p=m(1)+m(2)+m(3) Print p End Sub Private Function m(n As Integer) As Integer Static s As Integer For k=1 To n s=s+1
-
在窗体上画一个名称为Command1的命令按钮和两个名称分别为Text1、Text2的文本框,如图5所示,然后编写如下程序: Function Fun(x As Integer, ByVal y As Integer) As Integer x=x+y If x<0 Then Fun=x Else Fun=y End If End Function Private Sub Command1_Cli
-
设有学生成绩表 score(sno,cno,grade) ,各字段含义分别是学生学号、课程号及成绩。现有如下创建 存储函数的语句:以下关于上述存储函数的叙述中,错误的是 ______。CREATE FUNCTION fun()RETURNS DECIMALBEGINDECLARE x DECIMALSELECT AVG(grade)INTO x FROM scoreRETURN x END;
-
设有如下通用过程:Public Function f(x As Intege()
-
在窗体上有1个名称为Command1的命令按钮,并有如下事件过程和函数过程: Private Sub Command1_Click() Dim p As Integer p=m(1)+m(2)+m(3) Print p End Sub Private Function m(n As Integer)As Integer Static s As Integer Fork=1 To n s=s+1 N
-
有如下函数过程: Function Fun(By Val x As Ingeger,ByVal y As Integer) As Integer DO While …y<>0 reminder=x Mod y x=y y=reminder Loop Fun=x End Function 以下是调用该函数的事件过程,该程序的运行结果是 Private Sub Command1_Click() Dim
-
在窗体上画一个名称为Command1的命令按钮和两个名称分别为Text1、Text2的文本框,然后编写如下程序: Function Fun(x As Integer, ByValy As Integer)As Integer x=x+y If x<0 Then Fun=X Else Fun=y End If End Function Private Sub Command1_Click() Dim