74 3 19 23 21 62 Array iNums Write a statement that populates a two-dimensional
ID: 3767555 • Letter: 7
Question
74
3
19
23
21
62
Array iNums
Write a statement that populates a two-dimensional array named iNums with the values above using shortcut notation. Use the values above.
Write a statement to display the value stored in iNums[0][0].
Write a statement to display the value stored in iNums[2][2].
Write the statements needed to display the number of rows and columns in the array as follows:
Rows: 2
Cols: 3
Write a statement that adds 5 to the value stored in iNums[1][2].
Sum the second value in the first row and the last value in the second row to the variable iSum.
Sum all values in the second row to the variable, iRowTotal.
Sum the values in the second column to the variable iColTotal.
74
3
19
23
21
62
Explanation / Answer
Question A)
Write a statement that populates a two-dimensional array named iNums with the values above using shortcut notation. Use the values above.
Answer for this Question is:
Declartion of INums two dimensional arrays is :
int iNums[][]= {{74,3,9},{23,21,62}};
Question B)
Write a statement to display the value stored in iNums[0][0].
Answer for this Question is below:
print "iNums[0][0] index value is", iNums[0][0] = 74
Question C)
Write a statement to display the value stored in iNums[2][2].
Answer for this Question is below:
print "iNums[2][2] index value is", iNums[2][2] = 60
Question D)
Write the statements needed to display the number of rows and columns in the array as follows:
Answer for this Question is below:
Declaration of Rows and Cols and initialise
Rows: 2
Cols: 3
print " Number of Rows and Columns in the given arrays is: ", Rows, Cols
Question E)
Write a statement that adds 5 to the value stored in iNums[1][2].
Answer for this Question is below:
int sum = 0 ;
sum = 5 + iNums[1][2] = 5 + 21 = 26
Question F)
Sum the second value in the first row and the last value in the second row to the variable iSum.
Answer for this Question is below:
Declare :
int iSum = 0;
iSum = iNum[0][1] + iNum[2][2] = 3 + 62 = 65
Question H)
Sum all values in the second row to the variable, iRowTotal.
Answer for this Question is below:
Declare:
int iSum = 0;
iSum = iSum + iNum[1][0] + iNum[1][1] + iNum[1][2] = 23 + 21 +62 = 105
print "iSum", iSum; // 23 + 21 + 62 = 105
Question I)
Sum the values in the second column to the variable iColTotal.
Answer for this Question is below:
Declare:
int iSum = 0;
iSum = iSum + iNum[0][1] + iNum[1][1] = 3 + 21 = 24
print "iSum", iSum;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.