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

  Create a assembly language subroutine

Create a assembly language subroutine MULSUM that takes an array named A containing n bytes of positive numbers, and fills two arrays, array B containing n words and array C containing n long words

  Write a function in linux assembly

Write a function in Linux assembly

  Analog measurements

Prepare an assembly program for the correctly measures the wind direction

  Design a simple digital clock

Design a simple digital clock

  Write an assembly program

Prepare an Assembly program that reads in a number of cents.

  Write an assembly language program

Write an assembly language program for encrypting alphabates of a string

  Greatest common divisor of integers-masm assembly language

Must be done in MASM assembly language: Greatest common divisor of two integers is largest integer which will evenly divide both integers. GCD algorithm involves integer division in a loop.

  Write assembly program-find right admission price to movie

Write the Assembly program to find correct admission price to movie. Price of admission to a movie is $7 for kids (under 12) and $9 for adults.

  Create simple 8-bit alu using add-subtract-shift functions

Create a simple 8-bit ALU. Requirements:The eight functions that you will implement are: add, subtract, and, or, shift left logical, less than, shift right logical.

  Write assembly program print binary representation-integers

Write the assembly program called hw6_ex1, stored in file hw6_ex1.asm. This program must prompt user to enter signed 32-bit integer. Program must print out binary representation of the integer.

  Allot op-codes and add microcode to microprogram

Allot op-codes and add microcode to microprogram of Mic-1 to implement following instructions which are then included with IJVM instruction set.

  Write mips assembly program to read two non-negative numbers

Write MIPS assembly program to repeatedly read two non-negative integers and print integer product and quotient without using multiplication and division instructions.

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