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

6th grade math help me, please :)
Question Consider this expression. 4/2² - 6² Type the correct answer in the box. Use numerals instead of words. For help, see this worked example e. When a = -5
Three-fourths of the water leaked out of a full aquarium tank. and 15 gallons of water was left. After the leak was fixed, 10 gallons of water was added to the
Determine which of the four levels of measurement (nominal, ordinal, interval, ratio) is most appropriate. Years in which U.S. presidents were inaugurated
Please help!! Thank you in advance! Will mark Brainliest!
Select all the correct locations on the image. Which items are matter?
Marcus cast his fishing line ___ the water near the Reed's and caught a 3 lb bass.
help. What is the Fall of mankind?
The compare_strings function is supposed to compare just the alphanumeric content of two strings, ignoring upper vs lower case and punctuation. But something is
plls 20 poinsts will mark brainlest