Tuesday, August 18, 2009

//Program to Find Factorial of given number

class FindFactorial
{
public static void main(String[] args)
{

if(ContainNumber.onlyNumbers(args[0])){
int number = Integer.parseInt(args[0]);
int result = 1;
while(number>0){
result = result*number;
number--;
}
System.out.println("Factorial of given number : " + result);

}
else{
System.out.println("Enter number is not positive integer");
}
}
}

1 comment:

  1. perfect, this one is almost good.. the only missing thing is already asked in another post.
    I will give 9/10

    ReplyDelete