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

which statement is rue about <3 and <4
What is the answer???
HELP ME OUT HERE PLEASEE I WILL MAKE BRAINLIST TO THE PERSON WHO DID EXPLANATION.
can someone please answer this for me ?
what role is the king giving himself with regard to macbeth and banquo?????
A bag contains 5 red balls and 3 blue balls. A ball is picked at random from the bag and not replaced. Another ball is then picked at random. What is the proba
A square block of steel with volume 10 cm3 and mass of 75 g is cut precisely in half. The density of the two smaller pieces is now... A. two times the origina
Convert 2y-13=4x to slope intercept form
Which of the following discoveries was not made by an ancient Indian astronomer? 1.The sun is the center of the solar system. 2.The sun is a star. 3.Earth is ro
Suddenly he remembered a famous pharaoh whose name appeared in ancient Greek chronicles and also in the Biblical Book of Exodus: Rameses, or Ramesses. Based on