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

You are given two solid materials one that is organic and one that is not organic. Describe three tests you could perform to help you decide which is which.
You are given two solid materials one that is organic and one that is not organic. Describe three tests you could perform to help you decide which is which.
How do you divide. Please help I can't remember.
Why does a bike get heavier when it rusts???Very confussed, I cant find anything on the internet :( please help
To make curtains for a living room window for a customer, you will need three pieces of fabric in the following lengths: 3 feet, 3 feet, and 5 feet. What is th
How would I find the slope intercept form of x+y+3=0?
How do figure out 120/f = 1.2?
What kinds of activities made up the early economies of the North American colonies?
2*10^30/1.4*10^27 and round it to the nearest tenth
2+3=8, 3+7=27, 4+5=32, 5+8=60, 6+7=72, 7+8=???????? SOLVE IT IF YOU CAN