Get the answers you need at Westonci.ca, where our expert community is dedicated to providing you with accurate information. Explore thousands of questions and answers from a knowledgeable community of experts ready to help you find solutions. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals.

Give a recursive algorithm for finding the sum of the
first n odd positive integers.

Sagot :

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