+ 1
How to write code in c++ to find factorial of large numbers...???
Please elaborate the whole algorithm to do it..... Also see inserted code and suggest me the way problem can be solved.... https://code.sololearn.com/c016Nk2d4iLF/?ref=app
3 Answers
0
$|<|>_@&
Change the line 7 and 10
As unsigned long long int
0
Mohan 333 Bro what for large numbers.....??
It even doesn't work for 78, 100 .......etc showing output 0.........
I think as long long max is 2^63-1 ,but for large numbers ,their factorial will be extremely large number ,then how do long long type can store them which is greater than its max....
If this is the problem then how can i resolve it or any other alternative for the same???
0
$|<|>_@&
If you change the line 7 and 10 as a my 1st answer, You would get factorial of 65 is the maxium.
And factorial of 100 has a 158 digits. So any modifiers (long,short....ect) can't do this because of the memory issue.
So can try to store digits of a factorial numbers as array.
Below is helps to you↓
https://www.google.co.in/amp/s/www.geeksforgeeks.org/factorial-large-number/amp/
In python has a solution for this↓
https://code.sololearn.com/cKMts0BeA3ws/?ref=app
https://code.sololearn.com/c9LQlk13lc69/?ref=app