A function that takes as input n, an even integer and calculates the sum of first n even natural numbers.
function sum( n )
{
if(n equals 2)
return 2
else
return (n + sum(n-2))
end
}
It calls the function by the statement, sum(30). How many times will the function
sum be called to compute this sum.
A. 1
B. 30
C. 15
D. 16
Answer: Option C