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 me plzzzzzzzzzzzzzzzzsss
how do i solve 4x - 7= 29?
Fred's frog jump seven times as far as sells frog the two frogs jump a total of 56 inches how far did Fred's frog jump
What is 35-x/5=x/2?
what is ten times the sum of half a number and 6 is 8
Andy and Elizabeth each rounded 2639456 to the nearest ten thousand Andy got 2640000 Elizabeth got 2630000 Who is correct explain the error that was made
ELEMENTARY SCHOOL MATHEMATICS 5+3 pts The student population at south side middle school is listed in the table below Boys Girls 98 102 89 105 123 117 A. Use
Two thirds a number plus 4 is 7
Find the most important variable in the problem. A grocery store has a shelf of 48 2-liter sodas. At the end of the day, half are gone. How many sodas were left
katie is making a package to send to her grandmother. the candy she wants to mail weighs 3/4 of a pound. the letter weighs 1/12 of a pound and the packaging its