0% found this document useful (0 votes)
2 views1 page

Array Question Answer

The document describes the declaration and initialization of a 2 by 3 integer array named X in a programming context. It outlines the number of rows, columns, and elements, and provides code snippets for setting a specific element, initializing all elements, and inserting elements via input boxes. Additionally, it includes a method for printing the elements of the second row of the array.

Uploaded by

sarhjnydat9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Array Question Answer

The document describes the declaration and initialization of a 2 by 3 integer array named X in a programming context. It outlines the number of rows, columns, and elements, and provides code snippets for setting a specific element, initializing all elements, and inserting elements via input boxes. Additionally, it includes a method for printing the elements of the second row of the array.

Uploaded by

sarhjnydat9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

2 by 3 Integer Array X

a) Declaration statement:
Dim X(1 To 2, 1 To 3) As Integer

b) Number of rows:
2 rows

c) Number of columns:
3 columns

d) Number of elements:
6 elements

e) Elements of X:
X(1,1) X(1,2) X(1,3)
X(2,1) X(2,2) X(2,3)

f) Set row 2 column 1 to 15:


X(2,1) = 15

g) Nested loop to initialize all elements to 10:


For i = 1 To 2
For j = 1 To 3
X(i,j) = 10
Next j
Next i

h) Nested loop to insert elements using input boxes:


For i = 1 To 2
For j = 1 To 3
X(i,j) = InputBox("Enter element")
Next j
Next i

i) Print elements of the second row:


For j = 1 To 3
Print X(2,j)
Next j

You might also like