Menu

[Solved]Language C Use Following Definition Questions 4 5 Int X 4 4 1 2 3 4 5 6 7 8 9 8 7 3 2 1 7 Q37044207

The language is C++

Use the following definition in questions 4 and5:

int x [4][4] = {{1,2,3,4}, {5,6,7,8}, {9,8,7,3},{2,1,7,1}};

4. Give the value in sum after the followingstatements are executed:

int sum = x[0][0];

for (int k = 1; k <=3; ++k) sum += x[k][k];

5. Give the value in sum after the followingstatements are executed:

int sum = 0;

for (int index1 = 0; index1 < 4; index1++)

for (int index2 = 0; index2 < 4; index2++)

if (x[index1][index2]> x[index1-1]index2])

sum ++;

Expert Answer


Answer to The language is C++ Use the following definition in questions 4 and 5: int x [4][4] = {{1,2,3,4}, {5,6,7,8}, {9,8,7,3}, … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *