fork download
  1. import java.util.Scanner;
  2.  
  3. class Demo
  4.  
  5. {
  6.  
  7. public static int A(int no)
  8. {
  9. int count=1;
  10. for(int m=1;m<=no;m++)
  11. {
  12. count = count*m;
  13. }
  14.  
  15. return count;
  16. }
  17.  
  18. public static void main(String args[])
  19. {
  20. Scanner s = new Scanner(System.in);
  21. int n=s.nextInt();
  22. for(int i=0;i<n;i++)
  23. {
  24. int num = s.nextInt();
  25. System.out.println(A(num));
  26.  
  27. }
  28.  
  29.  
  30.  
  31.  
  32. }
  33. }
Success #stdin #stdout 0.11s 380672KB
stdin
5
1
10
20
30
40
50
stdout
1
3628800
-2102132736
1409286144
0