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 do the two elements silver and iron have different properties?
Ramiro is 3/10 as tall as the flagpole. The flagpole is 5/9 as tall as the nearby tree. The tree is 32 2/5 feet tall. How tall is Ramiro?
which type of energy is associated with random motion of atoms and molecules in a sample of air? 1.chemical energy 2. electrical energy 3.nuclear energy 4. th
What is an analogy for democracy?
how many thirds in 5
Stem-and-Leaf Plots question: How many swimmers were younger then 30 Stem -- Leaf 0 1-- 1 2-- 3,9 3 --
A basketball player achieves a hang time of 0.773 s in dunking the ball. What vertical height will he attain? The acceleration of gravity is 9.8 m/s^2 .
how many hundredths are in 0.5
Given: L is the midpoint of KM M is the midpoint of LN Prove: KL = MN
a bicyclist rides 1/5 mile in 1/65 hour. Write this rate as a unit rate