试题

试题 试卷

logo

题型:填空题 题类:常考题 难易度:困难

算法与程序设计

在窗体上显示杨辉三角形,如下图所示:如果显示6行,则第1行数字前有5个空格,第2行前有4个空格,第3行数字前有3个空格……

解决该问题的VB程序段如下,在划线处填入正确的语句以实现功能。

Dim a(0 To 10) As Integer

Dim b(0 To 10) As Integer

n = 10

For i = 0 To 10

a(i) = 0

Next

a(1) = 1

b(1) = 1

For i = 1 To n

s = ″ ″

For j = 1 To

s = s + ″ ″'在s中加入一个空格

Next

For j = 1 To i

b(j) =

s = s + Str(b(j))

Next

Print s

For j = 1 To i

a(j) = b(j)

Next

Next

返回首页

试题篮