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

Find the area for the circle to the nearest hundredth. d = 15 m
Employees at​ Al's Super Mart constantly reorganize and reshelve merchandise. In doing​ so, they calculate floor space needed for displays. The algebraic expr
If you can walk 3 miles per hour, how much is that in meters per second?
Where is the three-day retreat portrait of the artist?
Write tge slope-Intercept form of the equation of each line given the slooe a and y-Intercept.
How did the historical setting influence the cold war?
Using a variety of sentences confuses the reader and should be avoided. True or False.
What is the suns length.
A flexible helium-filled party balloon is released in the atmosphere. as it gains altitude, what happens to the density of the balloon? 1. decreases at first, t
Which formula represents a polysaccharide that consists of five monosaccharides joined together by dehydration synthesis? A. C6H12O6 B. C30H60O30 C. 5C