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

The hero arose, surrounded closely by his powerful thanes. A party remained under orders to keep watch on the arms; the rest proceeded, led by their prince
Which Egyptian pharaoh built the most monuments? A. Hatshepsut B. Thutmose II C. Thutmose III D. Ramses II
chest volume is 8100 cubic inches the length is 30 inches and the width is 15 inches how tall will the chest be
NEED HELP ASAP PLEASE HELP!!!! 1) _______ believed that salvation is achieved through faith alone. A) John Calvin B) Ignatius of Loyola C) Desiderius Erasmus
Is 7040 greater less then orr equal to 4 miles
According to guidelines from the Physical Activity Guidelines for Americans, people should perform resistance exercises __________ per week.
400,000 rounded to the nearest ten thousand
What is the reason for each step in the solution of the equation? 4x−1=−2(x+1) 4x−1=−2x−2 6x−1=−2 6x=−1 x=−16
please help me with this problem. image attached.
Read the following scenario and answer the question that follows: Kelly gave a presentation to fellow coworkers, her supervisor, and clients. During the presen