In this tutorial how to find a Factorial of a number in Core Java is shown.
Code:
Factorial.java
class Fact
{
public static void main(String args[])
{
int number=Integer.parseInt(args[0]),fact=1,i;
for(i=number;i>0;i–)
{
fact*=i;
}
System.out.println(“Factorial of “+number+” is “+fact);
}
}