Integer type is too small for carrying 100! which is 10^156ish. you need to emulate these operation in you code
On Sep 4, 6:58 am, nuan <[email protected]> wrote: > There is the problem given on thehttps://www.spoj.pl/problems/FCTRL2/ > > and I'm submitting a solution for the problem but it's responding > wrong answer. I don't know why? > > Submitted Solution: > > #include<iostream> > using namespace std; > > int Factorial(int M); > int main() > { > int j,t,n; > cin>>t; > for(j=0 ; j < t; j++) > cin>>n; > Factorial(n); > > } > > int Factorial(int M) > { > int i,factorial=1; > for(i=1 ; i<=M; i++) > { > factorial=factorial*i; > } > return factorial; > > } > > Thanx in advance. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
