(11)在窗体上画一个名为 Command1 的命令按钮,然后编写如下程序:Private Sub Command1_Click( )Dim i As IntegerSum=0n=InputBox("Enter a number")n=Val(n)For i=1 To nSum= 【12】Next iPrint SumEnd SubFunction fun(t As Integer)As Longp=1For i=1 To tp=p*iNext i【13】End Function以上程序的功能是,计算 1!+2!+3!+?+n!,其中 n 从键盘输入,请填空。
(11)在窗体上画一个名为 Command1 的命令按钮,然后编写如下程序:
Private Sub Command1_Click( )
Dim i As Integer
Sum=0
n=InputBox("Enter a number")
n=Val(n)
For i=1 To n
Sum= 【12】
Next i
Print Sum
End Sub
Function fun(t As Integer)As Long
p=1
For i=1 To t
p=p*i
Next i
【13】
End Function
以上程序的功能是,计算 1!+2!+3!+?+n!,其中 n 从键盘输入,请填空。
相关考题:
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() a S="VisualBasic" Print String(3, a$) End Sub 程序运行后,单击命令按钮,在窗体上显示的内容是______。A.VVVB.VisC.sicD.11
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:Private Sub Commandl_Click( )Static X As IntegerStatic Y As IntegerClsY=1Y=Y+5X=5+XPrint X, YEnd Sub程序运行时,3次单击命令按钮Command1后,窗体上显示的结果为【 】。
在窗体上添加一个命令按钮(名为Command1),然后编写如下程序:Private Sub Command1_Click()Dim a As Integer,b As Integerx=10y=20End Sub打开窗体运行后,单击命令按钮,消息框的输出结果为( )。
在窗体上画一个命令按钮,名称为Command1。然后编写如下程序: Private Sub Command1_Click() Dim i As Integer,a As Integer Do While i<20 Do While True If i Mod 10=0 Then Exit Do Else i=i-1 End If Loop i=i+11 a=a+i Loop Printa End Sub程序运行后,如果单击命令按钮,则在窗体上显示的内容是( )。A.21B.32C.33D.11
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Privme Sub Command1_Click( ) a$="VisualBasic" Print String(3,a$) End Sub 程序运行后,单击命令按钮,在窗体上显示的内容是A.VVVB.VisC.sicD.11
在窗体上画一个命令按钮,名称为Command1。然后编写如下程序: Private Sub Command1_Click() Dim j As Integer,s As Integer s=1 Do s=s+j j=j+1 Loop Until j>=5 Print s End Sub 程序运行后,单击命令按钮,在窗体上输出的结果是( )。A.11B.1C.16D.7
在窗体上画一个名为Command1的命令按钮,编写如下程序:程序运行后,单击命令按钮,输出的结果是_________。