This is Discussion thread about Facto Sum
Discussion About Facto Sum
#include
using namespace std;
int fact (int n){
if( n==0 || n==1)
return 1;
return n*fact(n-1);
}
int main() {
int t;
cin>>t;
int sum =0;
while(t--){
int m;
cin>>m;
sum+=fact(m);
}
cout<<(sum%107);
return 0;
}
what is the problem with this code?
you can use after
sum +=fact(m);
sum=sum%107;
then it’s right answer…