Hi,
Below code is to find "Factorial of a given number"
Ex: n = 99
Output: (which is wrong output) 933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000
If n is very long integer i.e. n=100000 (1 Lakh), then output will get struct. we never get output.
What my query is, If I use any long integer ("trillion" or more), I should get the correct result in a very short time with no trouble. Please share tips on this issue.
Below code is to find "Factorial of a given number"
n=int(input("enter a end range: ")) s=1 for i in range(1,n+1): s=s*i print(s)for smaller n values code returns correct output. for big numbers (ex: 99 / 999 / 9999) it gives wrong output. that means, The result in output ends with zeros.
Ex: n = 99
Output: (which is wrong output) 933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000
If n is very long integer i.e. n=100000 (1 Lakh), then output will get struct. we never get output.
What my query is, If I use any long integer ("trillion" or more), I should get the correct result in a very short time with no trouble. Please share tips on this issue.