Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions