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

Which of the allies suffered the greatest losses on D-Day
The significance of the Open Door Policy for the United States lay in its (A) providing a use for the Philippines as a way station between China and the United
what does etymology study?
A flight instructor charges $50 per lesson, plus an additional fee for the use of his plane. The charge for the use of the plane varies directly with the square
What is 1997 from 2014????????????
How many grandparents have my grandparents? who can solve it is very good on maths! it is just a lpgic problem! i know the answer :)
If it takes Mark twice as long to earn $6.00 as it takes Carl to earn $4.00, what is the ratio of Mark’s pay per hour to Carl’s pay per hour?
least number that has 2, 3, 4, as factors
What is 0.05 percent of 6.5?
least number that has 2, 3, 4, as factors