Big Integer to the Rescue!
Out of Free Stories? Here is my Friend Link.
The simplest factorial problem which everyone knows will become hard to solve when it cannot be stored by an int. Which we use traditionally. Thus to overcome this restriction of space. We can introduce the concept of Big Integers. This is a class in Java which is used to handle huge values. Where a traditional int cannot be used. And data that can’t be stored even in a 64-bit long long variable.
I have published an ebook. A compilation of 100 Java(Interview)Programming problems which have been solved . I have given clear explanation and the code in the book. Believe me when I say, this will kick start you to achieve the job at your dream company.
Click on this link to get you to the landing page. It is completely free when you use kindle amazon. Take a look at it! Reviews are most Appreciated.
The application of Big Integer class, can be found in the following program.
Extra Long Factorials
Calculate and print the factorial of a given integer.
Input Format
Input consists of a single integer n.
Output Format
Print the factorial of n.