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

compare and contrast the sister relationship between anna and kate
What is 2.7 repeating as a fraction or mixed number in simplest from?
Write 4/5, 1/5, and 3/8 as decimals. Round them to the thousandths place.
9(4x + 13) + 14x - 19 (Please help)
True or false? for any two nonzero integers, the product and quotient have the same sign.
If you push down on a table with a force of 5 newtons, what is the normal force pushing back to you
If 40% of a number is 56 what was the original number
A rectangle has a length of 10 inches and a perimeter of 48 inches. Which equation could be used to find the width of the rectangle? a. 48 = 10w b. 48 = 20 – 2w
Translate the following into an equation: The product of a number and -3 increased by 4 is 12
The feeling of fervent devotion toward one’s nation above all others is known as?