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.
sum
n
fact
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); }