text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

c02p077.cpp

Go to the documentation of this file.
00001 
00017 int fact(int n)
00018 {
00019    if (n == 0)
00020       return 1;
00021    else  // Invariant: n > 0, so n-1 >= 0.
00022          // Thus, fact(n-1) returns (n-1)!
00023       return n * fact(n-1);  // n * (n-1)! is n!
00024 }  // end fact

Generated on Sun Aug 27 11:05:08 2006 for AWLogo by  doxygen 1.4.6