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

What is a scale on a map?
Solve the equation x=x+3
If every positive number has two square roots and you can find the length of the side of a square window by finding a square root of the area, why is there only
Anyone know how to do this kind of algebra?  Compute the discriminants of the next two quadratic equations. Compare the result in (A) to that in (B). What do y
1/7(x+21)=-6 answer ?
Write equation in function form 2x+2y=8 and 6x-3y=12
1.133 g of silver nitrate was heated in an open tube. The silver residue weighed 0.720 g. During the reaction 0.307 g of nitrogen dioxide was also produced. Th
how come some girls don't get period cramps?
How many magnesium ions are present in 5.36 x 10-4 mol of magnesium iodide?
Anyone know how to do this kind of algebra?  Compute the discriminants of the next two quadratic equations. Compare the result in (A) to that in (B). What do y