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

After the discussion, what does the author of "On Writing Well" feel the students have learned about writing? O A. That everyone writes differently and there i
HELP PLEASEEE!!!!! SCHOOL START TOMORROW. NUMBER 21 and 22 ONLY
I have 300 beads. My sister has 60 more beads than I did. How many beads do my sister and I have altogether?​
why is Sikim not in the seven sisters ​​
plz help fast! worth 100 points ​
10 % off the regular price. what is the discount amount any price?
Alberto lee (reads) un libro la cafetería el estadio la biblioteca el salón de clase el auditorio
What is the replacement word for expensive
The main effect of the earth tilting is A. Heating B. Seasons C. Atmosphere D. Years
Which statement best describes a watershed?A. It is the depositing of sediments at the mouth of a river.B. It is the widest part of a river, where the most eros