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

Over what period of time would you expect to see large changes in mountains,canyons,and similar features of the earth?
Is STM semantically or acoustically encoded??
what It Trigonometry ?
Which of the following categories includes the most distantly related organisms? (A) family (B) species (C) class (D) genus (E) order
what are some reasons for limiting authority
Which substance will combine with oxygen gas to produce a greenhouse gas? a. Na b. S c. H₂ d. Ne e. C
what does the zeppelin
Identify the turning point of the function f(x)=x^2-2x+8 by writing its equation in vertex form. Show work
what does the zeppelin
if f(x)=|3x-4|+2, find f (-10)