123
Lv 4
123 發問時間: 電腦與網際網路程式設計 · 1 0 年前

Dim N(5) As Integer 要怎麼算?

要怎麼解以下的題目?

Dim N(5) As Integer

For L=1 To 5

N(L)=L*2-1

Next L

? N(0);N(2):N(4)

Dim A(5)

For Y=1 To 5

A(Y)=A(Y-1)+Y*3

Next Y

? A(0);A(2):A(5)

Dim A(3) As Integer

For Y=1 To 3

A(Y)=A(Y-1)+Y*5

Next Y

? A(1);A(2):A(3)

1 個解答

評分
  • 1 0 年前
    最佳解答

    1.

    Dim N(5) As Integer

    For L=1 To 5

    N(L)=L*2-1

    Next L

    ? N(0);N(2):N(4)

    N(0)=0

    N(2)=2*2-1=3

    N(4)=4*2-1=7

    2.

    Dim A(5)

    For Y=1 To 5

    A(Y)=A(Y-1)+Y*3

    Next Y

    ? A(0);A(2):A(5)

    A(0)=0

    A(2)=A(1)+2*3= (A(0)+1*3)+6 =3+6 = 9

    A(5)=A(4)+5*3= (A(3)+4*3)+15= (A(2)+3*3)+12+15=9+9+27=45

    3.

    Dim A(3) As Integer

    For Y=1 To 3

    A(Y)=A(Y-1)+Y*5

    Next Y

    ? A(1);A(2):A(3)

    A(1)=A(0)+1*5=5

    A(2)=A(1)+2*5=5+10=15

    A(3)=A(2)+3*5=15+15=30

還有問題?馬上發問,尋求解答。