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

of the grade 6 students surveyed, 12% bring their lunch to school. suppose 24 sixth graders do this. how many grade 6 students are at the school?
Complete the following analogy: Fort Sumter : The American Civil War :: ______ : _____ A. The finish line; a NASCAR race B. A house; a wall C. A tree; a branch
Mike weighs 24 more pounds than Mark. Together, they weigh 250 pounds. How many do they each weigh?
How many feet are in 144 inches? Please show work!!!!!
of the grade 6 students surveyed, 12% bring their lunch to school. suppose 24 sixth graders do this. how many grade 6 students are at the school?
choose the correct answer to complete the text. After the clas was over, i (1)...the school quickly. My watch showed 2.30 p.m. as i got on my bicycle. I pedaled
What was John Locke known for? A. He conducted and documented many scientific experiments. B. He argued for separating the powers of government into three disti
What is the answer to 3/8 + 4/5 ?
For breakfast, Bill had a bacon, egg, and cheese biscuit and two hotcakes totaling 660 calories. Phil had a bacon, egg, and cheese biscuit and three hotcakes to
x^{2} +16xy+63y ^{2}