fork(1) download
  1. #include <bits/stdc++.h>
  2. #define m 1000000007
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int t;
  8. cin>>t;
  9. while(t--){
  10. int n;cin>>n;
  11. if(n==0 || n==1)cout<<1<<"\n";
  12. else{
  13. long long int fact=1;
  14. for(int i=1;i<=n;i++){
  15. fact=fact*i;
  16. }
  17. fact=fact%m;
  18. cout<<fact<<"\n";
  19. }
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5512KB
stdin
3
5
20
50
stdout
120
146326063
500900139