VB输出下面图形的代码?谁帮我一下? 1 121 12321 1234321 123454321
2个回答
推荐于2018-04-15
展开全部
1
121
12321
1234321
123454321
可以分别表示为:
(10^0)^2
(10^0 + 10^1)^2
(10^0 + 10^1 + 10^2)^2
(10^0 + 10^1 + 10^2 + 10^3)^2
(10^0 + 10^1 + 10^2 + 10^3 + 10^4)^2
所以有:
Dim N As Long
Dim i As Integer
Dim j As Integer
For i = 1 To 5
For j = 0 To i - 1
N = 10 ^ j + N
Next j
Print Tab(6 - i); ' Print the space
Print N ^ 2
N = 0
Next i
输出结果:
1
121
12321
1234321
123454321
121
12321
1234321
123454321
可以分别表示为:
(10^0)^2
(10^0 + 10^1)^2
(10^0 + 10^1 + 10^2)^2
(10^0 + 10^1 + 10^2 + 10^3)^2
(10^0 + 10^1 + 10^2 + 10^3 + 10^4)^2
所以有:
Dim N As Long
Dim i As Integer
Dim j As Integer
For i = 1 To 5
For j = 0 To i - 1
N = 10 ^ j + N
Next j
Print Tab(6 - i); ' Print the space
Print N ^ 2
N = 0
Next i
输出结果:
1
121
12321
1234321
123454321
2013-12-14
展开全部
Private Sub Command1_Click()
Dim i, j As Integer
Dim a As String
For i = 1 To 9
Print Space(10 - i);
For j = 1 To i
a = a & j
Next j
For j = i - 1 To 1 Step -1
a = a & j
Next j
Print a
a = ""
Next i
End Sub
Dim i, j As Integer
Dim a As String
For i = 1 To 9
Print Space(10 - i);
For j = 1 To i
a = a & j
Next j
For j = i - 1 To 1 Step -1
a = a & j
Next j
Print a
a = ""
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询