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

Una finca rectangular tiene un perímetro de 2500 metros ¿cuánto mide el largo y el ancho de la finca si su largo tiene 50 metros más que el doble de su ancho?
Evaluate: Find the common ratio
Use the data in the Stem & Leaf plot to answer the following questions. STEM LEAF 0|5 1|13 2|56 3|302 4|974 5|2 ​
Nielson Motors has a share price of $50.00. Its dividend was $2.50, and you expect Nielson Motors to raise its dividend by approximately 6% per year in perpetui
write an assignment with the question explain why the methods used to teach learners in african indigenous can still be by teachers today History and philosophy
Moe, Joe, and Hiram are brothers. One​ day, in some​ haste, they left home with each one wearing the glassesglasses and coatcoat of one of the others. JoeJoe wa
Sino ang mas malawak ang kapangyarihan sa sistemang monarkiya
6 ст 4 cm 4 cm 15 cm 3 cm 5 cm 6 cm find Surface Area of Composite Figures
Round 3.75 to the nearest hole
Frederick Taylor believed that workers are primarily motivated by money or economic gain, and advocated an incentive pay system to motivate employees. Frederick