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 following is the equation of a line parallel to the line y=-x+1, passing through the point (4,1)? A. -x-y=5 B. x+y=5 C. x-y=-5 D. x+y=-5
Which is one way to estimate 102 ÷ 6 = 17? A. 105 ÷ 5 = 21 B. 105 ÷ 10 = 10.5 C. 100 ÷ 5 = 20 D. 102 ÷ 10 = 10.2
Raphael is twice as old as his sister. The sum of their ages is less than 30. What is the greatest age Raphael sister can be? A. 20 years old B. 15 years old C.
Which ratios would indicate linkage and not independent assortment? Check all that apply. A) 8:8:0: 0 B) 9:3:3:1 C) 12:2:2:1
what is mecca and why is it special to muslims
President _____ challenged Americans to send a person to the moon and back by the end of the 1960s. Kennedy Lincoln Washington
A bag has 5 blue marbles, 3 red marbles, and 2 green marbles. We draw two marbles, one at a time, with replacement. What is the probability that the first draw
How many 3/4s go into 9/2
Bacteria can grow rapidly when the temperature is between 41 and 135 degrees. This is known as: A. Cross contamination B. Customer dissatisfaction C. Danger Zon
What is the meaning of the prefix un-? A. over B. above C. under D. not