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

helpppppppppppppppppp
An online video daredevil is filming a scene where he swings across a river on a vine. The safety crew must use a vine with enough strength so that it doesn't b
PLEASE HALP ALL MY POINTS AND BRAINIEST
in the 1920s what were the positive and negative impacts of fossil fuels
what is the common obstacle in selling car parts
Hey guys! Can someone please tell me how to factor linear expressions I need it ASAP
can someone help me:)
Gina wants to go to the water park with her friends. They have a total of w dollars to buy 5 tickets. Each ticket costs 15 dollars
can someone help me please and thanks
out of 3 Mr. Alvarez makes a walkway cement slabs. He uses 14 cubic feet of cement to make the walkway. Each square slab has a volume of 4 cubic feet. cubic fee