Answer:
function sortArray()
Size =input('Enter the array size::');%this line used to take size of the array form the user
Random_array=int8((200-0).*rand(1,Size));%this line generates the random array with 1x5 size in range 0 to 200
disp('Random array:')%this line display's the content Random array
disp(Random_array)%this line display's the random numbers array
for i=1:length(Random_array)%this loop access each element in the array and stores index value in i
for j=(i+1):length(Random_array)%this loop access each element next to the index i and stores index value in j
if Random_array(i) > Random_array(j)%if value at index i greater than value at index j then this condition executed
temp = Random_array(i);%value at index position i store in the temp variable
Random_array(i) = Random_array(j);%we stores the value at index j at index position i
Random_array(j) = temp;%we stores the temp variable at index position in j
end
end
end
disp('Output array')%this displays the string in the in braces
disp(Random_array)%this displays the sorted array
end
sortArray()
Step-by-step explanation: