Looks to be a trivial question at the beginning, but the OP specified that he wants it for *50* and *bigger numbers*, which couldn't be calculated using this code. Well *50* could be calculated maybe if you change *int* to *long double*, but your limit is up to *200* I guess.
Not saying that I have a better solution though (than using *long double*), but wondering who needs to calculate such huge numbers? -- Amahdy www.amahdy.net On Sun, Aug 7, 2011 at 23:28, RAHUL TIWARI <[email protected]>wrote: > in c this program will be like this u may change this program in c++:- > int facto(int ); > #include<stdio.h> > main() > { > int n,fact; > > printf("\nenter the number for which you want to find the factorial"); > scanf("%d",&n); > fact=facto(n); > printf("\nthe factorial of yhe number %d is %d",n,fact);getch(); > } > int facto(int n) > { > > if(n==1) > return(1); > else > n= n*facto(n-1); > return n; > } > > > On Wed, Aug 3, 2011 at 1:49 PM, mandy <[email protected]> wrote: > >> Can anyone tell me how to compute factorial of 50 in c++ and even for >> bigger no. >> I am getting error(a default value) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "google-codejam" 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/google-code?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "google-codejam" 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/google-code?hl=en. > -- You received this message because you are subscribed to the Google Groups "google-codejam" 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/google-code?hl=en.
