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

3x(squared) +3y (squared) -54 =0 center and radius
Use the substitution method to solve the system of equation.choose the correct ordered pair. Y=10x-9 y=x+18
one half of the sum of a number and 10
of all the monsters and perils that odysseus and his crew face during their wanderings which do you think is the most terrifying
How many square feet are in a square mile?
Which of the following identifies the issue in the following scenario? The Kyoto Protocol, a treaty created to address global warming, faced numerous arguments
What is the name of the river that forms a border between mexico and the united states?
what is the most reasonable estimate for 54% of 168 A:8.4 B:46 C:84 D:110
Vicky made some purchases at the sunflower market. She bought strawberries for $3.50, carrots for $2.25 and a bouquet of flowers for $9.95. If sales tax is 5 pe
Which choice uses a semicolon correctly? Dad went fishing; but he didn’t catch anything. Dad went fishing; yesterday. Dad went fishing; however, he did