import [Link].
Scanner ;
public class Problem1 {
public static long factorial(int n) {
if (n < 0) {
throw new IllegalArgumentException("Factorial is not defined for negative
numbers.");
}
return (n == 0 || n == 1) ? 1 : n * factorial(n - 1);
}
public static void main(String[] args) {
Scanner scn = new Scanner([Link]);
int num = [Link]();
[Link]("Factorial of " + num + " is: " + factorial(num));
}
}