Factorial of N : C++ solution
int Fact(int N)
//Computes factorial of non-negative integer
//PRE: N must be greater than or equal to 0
//POST: Returns factorial of N; N unchanged
{ if (N==0) return 1;
else return N * Fact(N-1);
}
Previous slide
Next slide
Back to first slide
View graphic version