JoeM3388 JoeM3388
  • 03-04-2015
  • Computers and Technology
contestada

Give a recursive algorithm for finding the sum of the
first n odd positive integers.

Respuesta :

Hippalectryon
Hippalectryon Hippalectryon
  • 03-04-2015
I'm writing that in some sort of pseudocode; if you don't understand it, feel free to ask for more details in the comments.

function sumOdd(n)
    if n==1 then
        return 1
    end if
    return (sumOdd(n-1))+(n*2-1)
end function
Answer Link

Otras preguntas

having troubles with inequalities.. 3.8x + 14.5 < 32
what is the sum of 7/10 and 6/100
what is the sum of 7/10 and 6/100
which trinomial is equivalent to (3x-1)(x+4)
which trinomial is equivalent to (3x-1)(x+4)
what is the sum of 7/10 and 6/100
having troubles with inequalities.. 3.8x + 14.5 < 32
which trinomial is equivalent to (3x-1)(x+4)
what is the sum of 7/10 and 6/100
which trinomial is equivalent to (3x-1)(x+4)