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

Chance knows the length of a football field including end zones is 120 yd the width of the football field is 53.33 yards what is the area of the football field
In a rectangle, its length is two more than twice the width. If the perimeter is 28 cm, Find the dimensions of the sides if the perimeter is 28 cm?
Which best describes the process of editing a conclusion?
What is the prime factorization of 740?
Which social scientist would be most likely to work on understanding and interpreting the past? a geographer a lawyer an educator a historian
Why is it important for health care workers to wear personal protective equipment?
any help for this question , please !
Victoria has a bag with orange, yellow, and blue chips in it. Without looking, Victoria reaches into the bag and removes a chip. She records the color and retur
What happened after the japanese surrendered at the end of world war 2 what was korea's fate?
the top part of a fraction represents part of the whole