@jagdish How do I calculate factorial for large numbers. Plz elaborate
your answer....

On Sep 4, 7:04 pm, jagadish <[email protected]> wrote:
> Further more you are not printing the factorial itself!
>
> On Sep 4, 7:02 pm, jagadish <[email protected]> wrote:
>
> > @Nuan:
> > Hi Nuan,
>
> > The problem states that
>
> > "An integer t, 1<=t<=100, denoting the number of testcases, followed
> > by t lines, each containing a single integer n, 1<=n<=100."
>
> > N lies between 1 to 100..
> > Such a naive approach like yours would fail for larger numbers!
>
> > That is why you are getting a wrong answer!!
>
> > For this problem you need to do multiplication using arrays! or use
> > some language like python where larger datatypes for nos are
> > supported!
>
> > On Sep 4, 6:58 pm, 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.

Reply via email to