Advertisement
etonw

factorial function

Jul 6th, 2022
1,084
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. double factorial (double n)
  2. {
  3.     double x = n;
  4.     for(int i = n; i > 2; i--)
  5.         {
  6.             x *= (i-1);
  7.         } // end for
  8.     return x;
  9. } // end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement