Choose the correct option.
OPTIONS
The function given below takes an even integer "n" as the input and calculates the sum of first in even
natural numbers. The function is called by the statement "sum(30)". How many times will the function
"sum" be called to compute the sum?
function sum(n)
{
if (n equals 2)
return 2
else
return (n + sum(n-2)
end
}
Answers
Answered by
5
Answer:
The function will be called 16 times
Explanation:
Similar questions