Question: Using Mips Assembly find the maximum and minimum values of an array You can use this code to help you translate from C++ 0.#include using

Using Mips Assembly find the maximum and minimum values of an array You can use this code to help you translate from C++ 0.#include
  1. using namespace std;
  2. int main ()
  3. {
  4.  int arr[10], n, i, max, min;
  5.  cout << "Enter the size of the array : ";
  6.  cin >> n;
  7.  cout << "Enter the elements of the array : ";
  8.  for (i = 0; i < n; i++)
  9.  cin >> arr[i];
  10.  max = arr[0];
  11.  for (i = 0; i < n; i++)
  12.  {
  13.  if (max < arr[i])
  14.  max = arr[i];
  15.  }
  16.  min = arr[0];
  17.  for (i = 0; i < n; i++)
  18.  {
  19.  if (min > arr[i])
  20.  min = arr[i];
  21.  }
  22.  cout << "Largest element : " << max;
  23.  cout << "Smallest element : " << min;
  24.  return 0;
  25. }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!