The instructions to answer my question are below in bulletpo

The instructions to answer my question are below in bulletpoints, and write the code in Java, thank you.

During the sort of the array named my_array. two elements need to swap Using a variable named temp2 swap the values stored in slots 0 and 7 of the array You do not have to declare my_array or temp2, I will do that.

Solution

for (int i = 0; i < 8; i++)
{
for (int j = i + 1; j < 8; j++)
{
if my_array[i] >my_array[j])
{
temp2 =my_array[i];
my_array[i] =my_array[j];
my_array[j] = temp2;
}
}
}

The instructions to answer my question are below in bulletpoints, and write the code in Java, thank you. During the sort of the array named my_array. two elemen

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site