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

17 lines
370 B
Java
Raw Normal View History

2024-08-05 01:06:30 +05:30
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+".");
}
}