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

Use the four terms down below to write in Spanish about something a student might do during a school day?
What is a " tanabe sugano diagram"?
What were the last two states to ratify (approve) the constitution?
Mindy is taking MA 385 this Fall and two sections are offered. She estimates that if she takes Dr. J, her chance of passing the course is 80%, but if she takes
What other goals did lewis and clark hope to accomplish?
Why couldnt europeans use the land route to asia any more?
what is 6×9÷18+100-11+4
Need help with this problem
Intaglio printmaking can be dated back to the ___________ people, around the year 3000 BCE. a. Mesopotamian c. Egyptian b. Sumerian d. Gaelic
Some discount stores put products in large bins and let consumers hunt and find bargains. the price these consumers pay includes: