1. ## Recursive algorithm

Give a recursive algorithm for computing n * a using only addition, where n is a positive integer and a is a real number. Hint: add a to itself n times.

2. Originally Posted by zap1231
Give a recursive algorithm for computing n * a using only addition, where n is a positive integer and a is a real number. Hint: add a to itself n times.
This is the standard one:

$\displaystyle n \times a = \begin {cases} 0 & : n = 0 \\ (n-1) \times a + a & : n \ne 0 \end{cases}$

Or if 0 is not considered a positive integer, start with na = 1 when n = 1.