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 n + sum(n); else return 0; } int fact(int n) { if (n > 0) return n * fact(n); else return 0; }