Error Correction Question

Correct following program.


Function sum calculates summation from 0 to the number n and
function fact calculates factorial of the number n (n!) by recursive functions.
In both of functions, n is a non-negative number.



int sum(int n)
{
   if (n == 0) return 0;
   else return n + sum(n);
}

int fact(int n)
{
   if (n == 0) return 0;
   else return n * fact(n);
}

Result