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

For the fair the organizers ordered 32 rolls of tickets each roll of tickets has 100 tickets how many tickets were ordered in all?
800 is 10 times as much as_____
A worker in a sunglass factory can make 50 frames or 100 lenses per day. There are 90 workers. How many workers should make lenses?
evaluate -a.   a=2.2  need help
What's the verbal expression for "4(2x-7)"
can some help me better to remember the map of Europe ?
The moon is about 240,000 miles from Earth period what is the distance written as a whole number multiplied by a power of 10
5000 is 1/10 of what
can some help me better to remember the map of Europe ?
Can someone help me ?????