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

2. An ion is a charged particle that is formed when a. An atom gains electrons b. An atom loses electrons c. Both A and B d. None of the above
An injury to the spinal cord in which section of vertebrae could cause tetraplegia?
Help me plz thank you
solve the equation: |x+3| >2x-1
1. Make a list of festivals that you celebrate. Then, share your list with your friends.​
8. Find the area of the following triangle. h=8m b= 6.5
Find $24.75 as a fraction of $70. Give your answer in its lowest terms.
I need help asap!!!!Please explain the answer
Pencils are sold in a local store for 55 cents each. The factory has $1300 in fixed costs plus 15 cents of additional expense for each pencil made. Assuming al
PLZ HELP ITS TIMED Which of the following is punctuated correctly? A. The weight-lifting club (founded 1976) raised over a thousand dollars for charity this yea