Posted By

minedoc on 04/27/10


Tagged

1


Versions (?)

int Factorial (int n)递归计算n!


 / Published in: C++
 

  1. template<class T>
  2. T Factorial (T n)
  3. { //计算n!
  4. if (n<=1) return 1;
  5. else return n * Factorial(n- 1 ) ;
  6. }

Report this snippet  

You need to login to post a comment.