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

How is frogs excretory system different then the human system
why did saudi arabia build the coastal cities of yanbu and jubail
Individuals going through dramatic mood shifts in short periods of time may be suffering from: schizophrenia manic depression personality disorder obsessive com
The surface area of any shape is expressed in? a. feet and inches. b. square units. c. cubic units. d. length and width.
create environmental slogans for your city or town.
In what way does “Song of Myself” reflect Whitman’s brand of American epic poetry?
The attempts of free Jerusalem from Turkish controlled were called the?
Clues to what ancient climates were like come from all of the following EXCEPT a. fossil trees. b. very old weather records. c. fossil tree rings. d. an
help me answer question 49
Cheerfulness, sadness, or nostalgia in descriptive writing is known as _____. point of view figurative language visual image dominant mood