2。 15个0——99的正整数,降序排列?
3。 1
222
33333
4444444
的程序??
考试的,求你了!谢!
1.
Option Explicit
Private Sub Command1_Click()
Dim n As Integer
n = InputBox("请输入n")
Dim Sum As Double
Sum = JC(n)
Print Sum
End Sub
Private Function JC(n As Integer) As Double
Dim i As Integer
Dim t As Double
t = 1
For i = 1 To n
t = t * i
Next
JC = t
End Function
2.
Option Explicit
Option Base 1
Private Sub Command1_Click()
Randomize
Dim a(15) As Integer
Dim i As Integer
Dim j As Integer
Dim t As Integer
For i = 1 To 15
a(i) = Int(99 * Rnd + 1)
Next
Print
Print "原数据是:"
For i = 1 To 15
Print a(i);
Next
Print
For i = 1 To 14
For j = 1 To (15 - i)
If a(j) < a(j + 1) Then
t = a(j)
a(j) = a(j + 1)
a(j + 1) = t
End If
Next
Next
Print
Print "排序后:"
For i = 1 To 15
Print a(i);
Next
End Sub
3.
Option Explicit
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 4
Print Tab(10 - i * 2); String(i * 2 - 1, Trim$(Str$(i)))
Next
End Sub