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

in what way was maryland different from the other english colonies
One angle is 36°. What is the measure of its complement? A) 54° B) 64° C) 144° D) 324°
facts about the geosphere
How did the bourgeoisie differ from the people from the third estate?
How do you solve this equation ___ Al + ___ Na1 O1 H1 -___Na3 Al1 O3 + __ H2
A baseball player runs 27.4 meters from the batter’s box to first base, overruns first base by 3.0 meters, and then returns to first base. Compared to the total
The bottom of Onondaga Lake in upstate New York contains large amounts of pollutants. One proposal to clean the lake bottom requires that the pollutants be remo
Moving 4.0 coulombs of charge through a circuit requires 48 joules of electric energy. What is the potential difference across this circuit? (1) 190 V (3) 12 V
Even in Arts cluster there is a need for a. only an art degree.B. technology training. c. mostly unskilled labor. d. no new job seekers.
Why did the Soviet Union close its borders and restrict travel abroad?