Question

Write a complete program in assembly line that:    1. Prompt the user to enter 10...

Write a complete program in assembly line that:
   1. Prompt the user to enter 10 numbers.
   2. save those numbers in a 32-bit integer array.
   3. Print the array with the same order it was entered.
   3. Calculate the sum of the numbers and display it.
   4. Calculate the mean of the array and display it.
   5. Rotate the members in the array forward one position for
       9 times. so the last rotation will display the array in reversed order.
    6. Print the array after each rotation.
       check the sample run.
------------------------------------------------------------
      Don't use any shift or rotate instructions. You need to use loops and indexed addressing.
      All you work should be on the original array. Don't make
      a copy of the array at any time.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>

using namespace std;

int main() {

             

              int arr[10];

              for (int i=1;i<=10;i++){    //________________ taking input

                             cout<<"Enter "<<i<<" Element : ";

                             cin >>arr[i-1];

              }

              cout<<"\n"<<"Array created : "<<"\n";

              for (int i = 0;i<10;i++){

                             cout<<arr[i]<<" ";

              }

              int sum=0;

              for (int i = 0;i<10;i++){    //________________calculating sum

                             sum+=arr[i];

              }

              float mean=(float)sum/10;

              cout<<"\n\n"<<"sum : "<<sum<<"    mean "<<mean<<"\n";

              int count=1;

              int tmp;

              int index = 0;

              while(count<=9){            //______________rotating the array

tmp = arr[9];

for(int i=9;i>index;i--){

                             arr[i]=arr[i-1];

}

arr[index]=tmp;

index++;

cout<<"\n"<<"After "<<count<<" rotation :"<<"\n";

for(int i=0;i<10;i++){

                             cout<<arr[i]<<" ";

}

count++;

              }

              return 0;

}

Add a comment
Know the answer?
Add Answer to:
Write a complete program in assembly line that:    1. Prompt the user to enter 10...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a complete program that: 1. Promts the user to enter 10 numbers. 2. saves those...

    Write a complete program that: 1. Promts the user to enter 10 numbers. 2. saves those numbers in a 32 bit integer array. 3. Calculates the sum of the numbers and displays it. 4. Calcualtes the mean of the array and displays it. 5. Prints the array with the same order it was enterd. 6. Rotates the members in the array forward one position for 9 times. so the last rotation will display the array in reversed order. Print the...

  • Assembly Language////Write a program that read in 10 integers from the user. Save the numbers into...

    Assembly Language////Write a program that read in 10 integers from the user. Save the numbers into an array; reverse the array and display the reversed array. .data arrayInt DWORD 10 DUP(?) Your program consists of 4 procedures: 1. main procedure: call procedures getInput, reverseArray, displayArray 2. getInput procedure: prompt user to enter 10 integer numbers, save the numbers into the memory for the arrayInt 3. reverseArray: reverse arrayInt 4. displayArray: display the reversed array

  • 1. print mesage to user to prompt user to enter 10 numbers 2 have program accept...

    1. print mesage to user to prompt user to enter 10 numbers 2 have program accept 10 numbers from user and populate 10 occurrances of an array (use a loop to do this). 3. print message to user to advise user contents of array follows 4. have program display array contents (use loop to do this) end program comment in java please

  • In assembly language computer programming 1. create a 5 element array 2.prompt the user to enter...

    In assembly language computer programming 1. create a 5 element array 2.prompt the user to enter 5 numbers to fill the array 3. exchange the number at position 1 with the number at position 4 of the array. (Don't forget that array positions are counted from zero, in our case 5 element array positions are counted 0,1,2,3,4.) 4.Display the array numbers 1 and 4 to show that you did the exchange correctly. Show a message like "The number at position...

  • java programe Write a program that prompts the user to enter in an integer number representing...

    java programe Write a program that prompts the user to enter in an integer number representing the number of elements in an integer array. Create the array and prompt the user to enter in values for each element using a for loop. When the array is full, display the following: The values in the array on a single line. The array with all of the elements reversed. The values from the array that have even numbered values. The values from...

  • Write a C++ program that prompts the user to enter two numbers. Then prompt the user...

    Write a C++ program that prompts the user to enter two numbers. Then prompt the user to select from the following options: a. Add the numbers. b. Multiply the numbers. c. Terminate the program Use the appropriate control structures (loops, if else, switch-case, etc) to make your program as short and efficient as possible. Minor syntax errors are forgiven in this exercise; just focus on the correct structure, declarations and sequence of instructions

  • I need to Write a test program that prompts the user to enter 10 double values...

    I need to Write a test program that prompts the user to enter 10 double values into an array, calls a method to calculate the average of the numbers, and displays the average. Next, write a method that returns the lowest value in the array and display the lowest number. The program should then prompt the user to enter 10 integer values into an array, calculates the average, and displays the average. The program should have two overloaded methods to...

  • Write a test program that prompt the user to enter seven numbers, stores them in an...

    Write a test program that prompt the user to enter seven numbers, stores them in an array list and do the following: 1. Displays its elements (numbers) in increasing order by invoking a method with the following header that sorts the array: public static void sort(ArrayList<Integer>list) 2. Write a method that returns and displays the sum of all numbers (elements) of the ArrayList. Using the following header: public static double sum(ArrayList<Integer>list) 3. Write a method that removes the duplicate numbers...

  • Write a perl script to accomplish following tasks: 1. Prompt user to enter their name and...

    Write a perl script to accomplish following tasks: 1. Prompt user to enter their name and age, and then calculate and display their age in days. 2. Initialize a 20-element array of numbers and print each element. 3. Get a system host name. 4. Get a web page and save it to a file. 5. List background services (daemons) on your system.

  • Write a C program to do the following 1) request user to enter 10 integer into...

    Write a C program to do the following 1) request user to enter 10 integer into an array 2) sort the array in ascending order 3) display the sorted array 4) count the number of odd and even number in the array and print out the result 5) add the value of the odd number and even number and calculate the average of the odd and even number. display the result 6) write function addNumber() to add all the number...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT