MIT-Curricular/OOP/Java/Lab/Week1/Factorial.java

17 lines
370 B
Java

class Factorial
{
public static void main(String args[])
{
int a,i,product=1;
a = Integer.parseInt(args[0]);
for(i=a;i>0;i--)
{
product = product * i;
}
System.out.println("Factorial For the Number "+a+" is "+product+".");
}
}