fork download
  1. public class Main{
  2. public static long factorial(int a){
  3. if (a == 0)
  4. return 1;
  5. else
  6. return a*factorial(a - 1);
  7. }
  8.  
  9. public static void main (String[] args) throws java.lang.Exception {
  10. java.util.Scanner i = new java.util.Scanner(System.in);
  11. int a;
  12. int n = i.nextInt();
  13. System.out.print(factorial(n));
  14. }
  15. }
  16.  
Success #stdin #stdout 0.14s 35616KB
stdin
20
stdout
2432902008176640000