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

A Summer to Remember" has a distinct structure involving flashbacks, present-day narration, and multiple settings. Analyze how the structure and settings of the
© a = 9.6 rounded to 1 DP b= 7.70 rounded to 2 DP Find the maximum of a - b​
why does the voltage fall from a certain point where the maximum voltage reached?​
How many elements form compounds difficulty in the fourth period in the periodic table?​
During unusually cold weather, the temperature in Miami Beach was 10°C. This was 12 degrees more than Tallahassee. What is the temperature in Tallahassee?
To keep your muscles in good shape, you should aim for strength training _________ per week. A. five times B. three times C. once D. twice Don’t answer unless u
Which of the following foods are super hydrating? A. toast B. eggs C. roast beef D. cucumber
The graph of an function is shown on the coordinate plane. Which table of values represents coordinate points that lie on the line?
this figure has rotational symmetry. what is true about the figure?
uestion 36: It's not necessary for us to hurry. It's early now. (Use: modal verb).