fork download
  1. #include <stdio.h>
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. #ifndef ONLINE_JUDGE
  7. freopen("a.in", "r", stdin);
  8. freopen("a.out", "w", stdout);
  9. #endif
  10.  
  11. int t;
  12. scanf("%d", &t);
  13. int a[t];
  14. if(t >= 0 && t<=100)
  15. {
  16. for(int i=0; i<t; i++)
  17. {
  18. a[i]=1;
  19. int n;
  20. scanf("%d", &n);
  21. if(n >= 1 && n <= 100)
  22. {
  23. /*if(n == 1)
  24. a[i]=1;
  25. else
  26. {*/
  27. for(int j=n; j>0; j--)
  28. {
  29. a[i]=a[i]*j;
  30. }
  31. }
  32. }
  33. for(int k=0; k<t; k++)
  34. printf("%d\n", a[k]);
  35. }
  36. return 0;
  37. }
Success #stdin #stdout 0s 3300KB
stdin
4
1
2
5
3
stdout
1
2
120
6