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

Read and choose the correct option. ________ divertida. Ella es Él es Usted tiene Mi amigo tiene
How to create a machine that can create anything without any limitations
why is it so important to record all the data in a science experiment​
Which pair of words describes this system ? 3y=9x-6 2y-6x=4 A) inconsistent and independent B) consistent and dependent C) consistent and independent D) inc
Please answer the attached question by selecting of the the given answers.
what was the greek civilization
The cost of admission to a popular music concert was $162 for 12 children and 3 adults. The admission was $122 for 8 children and 3 adults in another music con
¿Dónde estaciones el coche? A. Salón b. estacionamiento C afeteria
Understanding Triangles Which statements about triangles are true? Select all that apply Two triangles can be put together to form a parallelogram The area of a
U is the set of positive integers less than 18. G is the set of positive factors of 12. What is the complement of set G in universe U.