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

Why does the octopus make a " screen" ?
If Dave drives at a steady speed of 50 miles per hour, how long will it take him to drive 10 miles? A: 12 minutes B: 10 minutes C: 15 minutes D: 30 minutes
How do I solve this if there are only 2 numbers
What is the value of x when 2x + 3 = 3x – 4 ? A. –7 B. -1/5 C. 1 E. 7
please help what Is the Torah?
why is it important to fight for your rights
Ms. Hernandez began her math class by saying: I'm thinking of 5 numbers such that their mean is equal to their median. If 4 of the numbers are 14, 8, 16, and 14
What is the slope of any line parallel to the line 9x + 4y = 7 ? F.–9 G.-9/4 H -9/7 J. 7 K.9
a drawer has some red ,green and blue marbles.there are 33 marbles . there are 4 times as many red marbles as green marbles.there are half as many blue marbles
Will Mount Vesuvius erupt again, like it did in 79 AD?