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

Help ASAP due in 13 mins
number 6 i dont understand and 7 and 8?
How many edges does the figure have? A prism with 12 edges. 6 8 12 24
Mayans believed that on certain ceremonial occasions a. their leaders were killed by the gods. b. their leaders danced with the gods. c. their leaders
My best friend lives across the street. The prepositional phrase in this sentence indicates A) who the best friend is B) what the best friend does C) where
I need this answered ASAP!! I have this due by the start of class Monday!! By the end of the summer, Tammy and Keith had mowed the same number of lawns and rake
Aldo bought 9 feet of fabric. How much is this in yards?
A rectangle’s length is 2 units more than twice it’s width
The line that passes through the points (-1,12) and (-6,7) has a slope of??
The perimeter of a rectangle is 48 inches. The length of the rectangle is 3 times the width of the rectangle. What is the area of the rectangle?