The number is really big!!Sometimes we find it out of capabilities for languages to work with huge numbers. In java we have a class which can work with any size of an integer.
Here i have implemented a factorial with the same. The logic is the same as for finding factorials. The code goes as follows ::
Read further here :: 25 factorial | TECHARRAZCode:import java.math.BigInteger; import java.lang.*; import java.util.Scanner; class largenumber { public static void main(String args[]) { Scanner in=new Scanner(System.in); System.out.println("Enter a number for factorial"); int num=in.nextInt(); BigInteger fact=BigInteger.valueOf(1); for(int i=2;i<=num;i++) { fact=fact.multiply(BigInteger.valueOf(i)); } System.out.println("Factorial "+num+" is ::\n\t"+fact); } }
Last edited by Chinmoy; 06-11-2008 at 05:54 AM.
God is real... unless declared an integermy blog :: http://techarraz.com/
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks