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

Not a homework question, but does anyone know how to identify fin rot? I have no idea, but every betta I had has had what I claim to be fin rot has died quickly
Need help ASAP. Please! Thank u☺️
LM=7, LN=10, MN=5, What can you conclude about the angle measures
SIMPLIFY the radical expression: square root of 75 + square root of 3
What happen when Gideon army blew their trumpet and waves their torches?
For model 5, the tip of the blade travels 0.18 mile per revolution. What is the approximate speed, in revolutions per minute,for model 5?
Which organism is not included in domain archaea a. cyanobacteria b. methanogens?
it is safe to tell an online acquaintance (someone you have never met in person) your A. Full name B. Address C. Phone number D. Favorite music
What inspired protesters to demonstrate at Tiananmen sqaure
Which of these would MOST likely impact providers of a local business (a restaurant, hair salon, etc)? A) new regional airports B) closing the Port of Savannah