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 did the interpretation of the Bill of Rights change in 1947
-10.6=m+11.7/0.5 what is m
#2 – Due to the many deaths of people working to build the Great Wall, what other name is the Great Wall known as? Answer 2:
Find the area of the circle to the nearest tenth. Use 3.14 for π.
A dictionary provides definitions for listed words. Please select the best answer from the choices provided T о F
Complete the expression that is equivalent to m + m + m + m. __m
Find the slope of the line that passes through (6,5) and (2,5). 0 Undefined 4 -4 D
1. A zoo has 340 animals and then increases the number of animals by 5%. How many animals are at the zoo now? 30 points!
Tar in cigarettes disrupts a process in the upper respiratory tract called the.
Please help me with this asap