VB程序阅读题:1. 执行下面程序段的输出结果是( )Private Sub Form_click() For i = 1 To 3
1.执行下面程序段的输出结果是()PrivateSubForm_click()Fori=1To3PrintTab(i);"$";NextiEndSub2.下面程序的输出结...
1. 执行下面程序段的输出结果是( ) Private Sub Form_click()
For i = 1 To 3
Print Tab(i); "$"; Next i End Sub
2. 下面程序的输出结果是( ) Private Sub Form_Click()
Dim a(10) As Integer, i As Integer For i = 0 To 10
a(i) = 2 * i + 1 Next i
Print a(a(3)) End Sub
3. 以下程序段通过For循环计算一个表达式的值,该表达式为( )。 Dim s As Double,x As Double s=0 n=0
For i=1 To 5 x=n/i n=n+1 s=s+x Next i
4. 下列程序的功能是输出如下数列的前20项,按每行5个数的形式输出。 1,1,2,3,5,8,13,21,...... 。在(1)(2)处填上相关语句,完成程序所需功能。 Private Sub Form_Click()
Dim a As Integer, b As Integer, c As Integer Dim i As Integer a = 1: b = 1: i = 3 Print a, b,
Do While (i <= 20) c = a + b a = b
( 1 ) Print c,
If i Mod 5 = 0 Then Print ( 2 ) Loop End Sub
5. 下面程序求1!+2!+…10!,在(1)(2)处填上相关语句,完成程序所需功能。 Private Sub Command1_Click() Dim s As Double, i As Integer For i = 1 To 10 s =( 1 ) Next i
Print "s="; s End Sub
Function fac(ByVal n As Integer) As Double Dim i As Integer Dim f As Double f = 1
For i = 1 To n f = f * i Next i
( 2 ) End Function 展开
For i = 1 To 3
Print Tab(i); "$"; Next i End Sub
2. 下面程序的输出结果是( ) Private Sub Form_Click()
Dim a(10) As Integer, i As Integer For i = 0 To 10
a(i) = 2 * i + 1 Next i
Print a(a(3)) End Sub
3. 以下程序段通过For循环计算一个表达式的值,该表达式为( )。 Dim s As Double,x As Double s=0 n=0
For i=1 To 5 x=n/i n=n+1 s=s+x Next i
4. 下列程序的功能是输出如下数列的前20项,按每行5个数的形式输出。 1,1,2,3,5,8,13,21,...... 。在(1)(2)处填上相关语句,完成程序所需功能。 Private Sub Form_Click()
Dim a As Integer, b As Integer, c As Integer Dim i As Integer a = 1: b = 1: i = 3 Print a, b,
Do While (i <= 20) c = a + b a = b
( 1 ) Print c,
If i Mod 5 = 0 Then Print ( 2 ) Loop End Sub
5. 下面程序求1!+2!+…10!,在(1)(2)处填上相关语句,完成程序所需功能。 Private Sub Command1_Click() Dim s As Double, i As Integer For i = 1 To 10 s =( 1 ) Next i
Print "s="; s End Sub
Function fac(ByVal n As Integer) As Double Dim i As Integer Dim f As Double f = 1
For i = 1 To n f = f * i Next i
( 2 ) End Function 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询