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

I need help on this question
what was the main reason of rivarly amongg the trading companies.
What should be done before resubmitting a claim that has not been paid and why is this important?
Hector is a strict father who demands and expects obedience from his children. what is his style of parenting known as?
the volume of 10000 drops of liquid is 10 fluid ounces. what is the volume of 10 drops?
how a whale carcass will help the deep ocean creatures
A spring stretches by 21.0 cm when a 135 n object is attached. what is the weight of a fish that would stretch the spring by 49 cm?
How do i solve this using a mathematical operation?
Prove algebraically that the square of any odd number is always 1 more that a multiple of 8.
A major difference in principles between aa and other treatment programs centers around the belief that