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

Collecting data from a sample that does not represent the population is called
Why do enzymes generally only bind to one type of substrate?
Can someone please help I will appreciate it
Papyrus was used as a surface for the Egyptian writing system called inscribing. hieroglyphics. pictographs. cuneiform.
Please help solve this: [tex] 3^{x + 1} = 100[/tex]
What does driving represent yo Saudi women?
Water is a polar molecule. this means that __________.
in which US state would you visit to meet Hyperion, the very tallest Redwood?
Small college has 2523 students in 1994 and 2891 students in 1996 if the enrollment follows a linear growth pattern how many students should the college have i
If r is five less than three times l, then r = A)3l - 5 B)5 - 3l C)5l - 3 D)3(l - 5)