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

PLSSSSS HELP PLS QUICKLY PLS
BRAINLIEST TO CORRECT
The sales tax on clothing in Louisiana is 4% . Calculate how much tax you need to pay on a dress if it costs $19.50 before before tax. Round your answer to the
How are the images, themes, or ideas in this propaganda similar to images, themes, or ideas in modern culture?
Please help, I’ll mark you as brainliest!!!!!!!!!!!!!
5. Use I = 3.14 to estimate the area of the circle. Round your answer to the nearest hundredth if necessary 164 m OA 844.53 m2 OB 25.75 m2 OC 211.13 m2 OD 51.5
If 4x-8y=5 is a true equation what would be the value of 3(4x-8y)
what felling did you have while reading/listening the story "The wondeful pear tree?​
Hot or Cold?Directions: Classify the following sandwiches as to Hot and Cold sandwiches.1. Multi-decker sandwich2. Regular hot sandwich3. Tea sandwich4. Grilled
Help me find the approximate area of the figure!!!