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

Please help quickly!!
In rhombus EFGH below, EF= 15 cm and EG= 18 cm Find the area of the rhombus. Be sure to include the correct unit in your answer.
why do charges build up in a cloud
please help im confused At a middle school, 74 students have freckles. There are 258 students in the school. To the nearest tenth of a percent, what percent of
What are two ways that humans pollute the land?
x−1 /8 = 2x/10 could you be willing to help me solve this
what is the best deal 16oz for 1.00$ small 21oz for 1.29$ medium or 32 for 1.49$ large
Por fin (poder) descansar in future tense
What should you do if you want a physical copy of a photo you see on a social networking site? O A. Add a name and tag it. O B. Hide it from your friends. O C.
What’s are consumers