Professional Documents
Culture Documents
Java Programming Example Finding Factorial Example
Java Programming Example Finding Factorial Example
com
(Factorial Example)
Java Factorial Example
This Java Factorial Example shows how to calculate factorial of a given number using
Java.
int number = 5;
/*
*/
factorial = factorial * i;
}
System.out.println("Factorial of a number is " + factorial);
Here in the code we can see that in the first few lines the definition for a factorial is
defined. Now, this definition is being applied in the following lines as “int factorial =
number” or factorial of an integer equals to the number – 1; the number must be
greater than 1 and the integer i is decremented by 1 until 1 is arrived at. The next
process is the multiplication of the numbers obtained. This is seen in factorial =
factorial*i. This will give the exact value of the factorial.
For more details you can visit our website at http://www.helpwithassignment.com and
http://www.helpwithassignment.com/programing-assignment-help