frozengirl309 frozengirl309
  • 03-07-2019
  • Computers and Technology
contestada

Give a recursive (or non-recursive) algorithm to compute the product of two positive integers, m and n, using only addition and subtraction ?

Respuesta :

SerenaBochenek SerenaBochenek
  • 14-07-2019

Answer:

Multiply(m,n)

1. Initialize product=0.

2. for i=1 to n

3.      product = product +m.

4. Output product.

Explanation:

Here we take the variable "product" to store the result m×n. And in this algorithm we find m×n by adding m, n times.

Answer Link

Otras preguntas

Write the fraction or mixed number as a percent. 11/20
Use the image below to answer the following question: What feature does this building have that tells you it’s is of Roman design
question is in the pic
What is the most important right we have? And why 250 words.
Which of the following shows the assignment of a string to a variable? Select 3 options. answer = input("How old are you? ") answer = "23" answer = '23' answer
solve the systems of equations by Elimination. Find the solution. -x+y=9 x+2y=6
Explain your answer !! Will give brainlst
What is active transport
The sum of four consecutive odd integers is 336. Find the largest integer.
the line with equation y= 2x + 3 is reflected in the x-axis. Which of the following is the equation of the new line? a) y = 2x + 3 b) y = -2x + 3 c) y = 2y +