Implementation of pow subroutine

Assignment Help Assembly Language
Reference no: EM133105188

Assignment: Parameter passing and local variables

Now that you have played around with some simple subroutines it is time to gain a more complete understanding of this important programming construct. In this assignment you will write a subroutine that takes several input parameters and returns a computed value. If you have not already done so, study the remainder of paragraph 3.3.2, which discusses the techniques and conventions surrounding subroutine parameter passing and return values.

Exercises:

Question 1: The following partial specification of the pow subroutine is given:

/**
* The pow subrout ine calculates powers of natural bases
* and exponents .
*
* Arguments :
*
* base = the exponential base
* exp = the exponent
*
* Return value : ' base ' raised to the power of ' exp ' .
*/
int pow( int base , int exp ) {
int total = 1 ;
// . . .
return total ;

}

Complete the specification of the pow subroutine. You should only use looping constructs and simple arithmetic operations to compute the total.

Question 2: You may have your specification checked by one of the lab course assistants. The lab course assistants can prevent you from implementing the wrong algorithm. If you are confident your specification is correct, you don't have to ask an assistant to check and you may immediately proceed with the next step.

Question 3: Write a program called "power" which contains an implementation of your pow subroutine. The main routine should ask the user for a positive base and exponent. The program should then calculate the resulting power using the pow subroutine and print the return value.

Reference no: EM133105188

Questions Cloud

The as-a-service revolution : "As-a-service" - the provision of services that we need to live and work through cloud-based, on-demand platforms - is the key that has put the other tech trend
Develop and name the type of measuring instrument : Develop and name the type of measuring instrument you would use to tap the following:
How should target inc account for the purchase : Target Inc. uses the cost method to account for treasury shares. How should Target Inc. account for the purchase of this treasury stock
Explain the different ways that the data science team : Explain the different ways that the data science team at Nutri Mondo could deploy what they have found in the data?
Implementation of pow subroutine : Parameter passing and local variables - Write a subroutine that takes several input parameters and returns a computed value
What was the amount of the original loan that you took : When you purchased your house, you took out a 30-year annual-payment mortgage with an interest rate of 6% per year. What was the amount of the original loan
How much would you have to fund this perpetuity : Given an interest rate of 5%, how much would you have to fund this perpetuity to guarantee the charity a payment of $50,000 per year
Prepare speech management : You will prepare a speech that includes visual aids. You will film the speech and post it to Canvas.
What is the product cm ratio : Feather Friends, Incorporated, distributes a high-quality wooden birdhouse that sells for $20 per unit. What is the product CM ratio

Reviews

Write a Review

Assembly Language Questions & Answers

  Write an arm assembly program that prints all the integers

Write an ARM assembly program that prints all the integers greater than 0 and less than 1000 that not divisible by 5. You must submit only a single file named "proj1.s" that is capable of running under ARMSim.

  Write a program to load the contents of memory location

Write a program to load the contents of memory location 2050 H into accumulator and then move this data into register B.

  Write down assembly program that calculates grade of student

Given a numeric score of a student, write down an assembly program that calculates the grade of the student as follows: if Score >= 90 then Grade = 1 else if Score >= 80 then Grade = 2 else Grade = 3 Program

  Write a set of assembly codes in uvision

Write a set of assembly codes in uVision that performs the function described below. Begin with the assumption that 10 randomly selected integer numbers (data) are stored at 0x20002000 to 0x20002024 in sequence in the memory region.

  Nonrecursive factorial

Write a nonrecursive version of the Factorial procedure that uses a loop and Write a short program that interactively tests your Factorial procedure.

  Write an assembly program in mips

Write an assembly program in MIPS that get the array size from the keyboard, then reads a list of integers from the keyboard and writes the sorted list in ascending order to the console screen.

  Explain the register-displacement addressing mode

Explain the register-displacement addressing mode. What stands for PC-relative addressing mode? Perform the binary addition and provide the decimal value.

  Write assembley langusge program to evalute

Write Assembley Langusge program to evalute: 3A+ (B + 5C) 4 +C where A=25, B=30, C=10

  Use a loop with indirect or indexed addressing

Use a loop with indirect or indexed addressing to reverse the elements of the integer array in place. Do not copy the elements to any other array

  Design an expanding opcode to allow to be encoded

Design an expanding opcode to allow all the following to be encoded in a 32-bit in- struction: 15 instructions with two 12-bit addresses and one 4-bit register number 650 instructions with one 12-bit address.

  Write a program that prompts the user to input a value n

Write an assembly language program that prompts the user to input a positive value n between 2and 20 and then it uses a loop to determine the sequence.

  Determine the maximum value and the minimum value

Take these three numbers determine the maximum value and the minimum value - Determine and display if the year entered is a leap year.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd