+ 1
I need program whiCH ables to calculates the factorial of 200 (200!).
I tried below program with unsigned long long but still 200! is more than that so I am getting 0 as output. #include<iostream> using namespace std; int num; int factorial(int n) { if (n==1) { return 1; } else { return n * factorial(n-1); } } int main() { cin >> num; cout << factorial(num); }
4 Respostas
+ 3
https://code.sololearn.com/cPPAOJn2h60d/?ref=app
@Eric thanks for the idea...
+ 5
You could use a vector<int> to make your own "BigNum" class. So instead of int=19345 you would have vector <int> {1, 9, 3, 4, 5}. Then you would have to define multiplication for these BigNum objects.
+ 4
Wow, you did it! Excellent!
0
Here is the code:
https://code.sololearn.com/cM4VQXlTNKYF/?ref=app