Write VB program to find multiplication table using dynamic array & Preserve keyword.

Write VB program to find multiplication table using dynamic array & Preserve keyword.

Private Sub Command1_Click()

Dim A() As Integer 'Empty array

Dim I As Integer

Dim N As Integer

Dim K As Integer

ReDimA(5)

N = InputBox("Enter a Number")

For I = 1 To 5

A(I) = N * I

Next I

K = InputBox("Enter Upto What Print")

ReDim Preserve A(K)

For I = 6 To K

A(I) = N * I

Next I

For I = 1 To K

    Print N & " * " & I & " = " &A(I)

Next I

End Sub


Comments