Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double f(double x)
- {
- if(x == 1) // base case
- {
- return 1;
- }
- else
- {
- return x * f(x-1); // recursion case
- }
- }
- int main()
- {
- // Test:
- cout << f(170); // the biggest number for C++ to calculate the factorial of
- }
Add Comment
Please, Sign In to add comment