i am having trouble with spoj.. i do not no what is wrong. Probably, it is due to the input
here's my code.
import java.util.*;
import java.io.*;
class Factorial{
Scanner input = new Scanner(System.in);
public long factorial(long m){
long result;
while(true){
m = input.nextInt();
if (m <= 1){
return 1;
}
else
result = m*factorial(m-1);
System.out.print(result);
}
}
public static void main(String[] args){
n = input.nextInt();
Factorial factorial = new Factorial();
Factorial.factorial(n);
}
}