Not able to use %ld(long int) in a factorial problem…Any idea why it is not acceting nd is there any other method??
Hi @ritish_1082 . Please post the complete code otherwise it is impossible to tell, where your code fails.
2 Likes
Factorials are very large.
0 : 1
1 : 1
2 : 2
3 : 6
4 : 24
5 : 120
6 : 720
7 : 5040
8 : 40320
9 : 362880
10 : 3628800
11 : 39916800
12 : 479001600
13 : 6227020800
14 : 87178291200
15 : 1307674368000
16 : 20922789888000
17 : 355687428096000
18 : 6402373705728000
19 : 121645100408832000
20 : 2432902008176640000
Factorial of 21 will not fit even in Unsigned long long int
You might want to share the problem link too. I tried finding the problem from your recent activity, but there is no related problem.
PS: If you need help, you need to provide the details
2 Likes
ahh i understand now where error is coming from. thanks