Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

HELP!! I have a test on this tonight!!! I am having trouble figuring out what th

ID: 3538225 • Letter: H

Question

HELP!! I have a test on this tonight!!!


I am having trouble figuring out what the following prints out:


1. for(r = 1; r < MAX; r++)

for(s = 0; s < MAX -r; s++)

if (ary[s] < ary [s + 1 ])

{ tmp = ary[s];

ary[s] = ary[s + 1];

ary[s + 1] = tmp;

}

for(r = 0; r < MAX; r++)

cout << ary[r] << " ";





2.a. for(i = 0; i < 10; i++)

for(j = 0; j < 5; j++)

matrix[i] [j] = (i+j)*(i+j); // i+j squared




b. Write the above code to print out the above array where you print one row of matrix per line of output




c. Show what is printed for the previous code first four (4) times of output




These are my study questions

Explanation / Answer

Somethings wrong.