WA in "Small Factorial-wrong answer" (FCTRL2)

Hi,
Can anybody point out the mistakes in the program below , the output seems to be correct when i run it in eclipse but Codechef IDE says wrong answer.
Thanks!
https://www.codechef.com/viewsolution/36763269

Answer will not fit in int

constraints goes upto 100,
this is how big 100! is = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000

what you need here is you need to apply old school method here using characters to strore numbers.
e.g. ->
mul('2' ,'5') = {'1','0'} < you got the idea right?

my solution .
i used int instead of chars. to store numbers and did oldscool math.
https://www.codechef.com/viewsolution/36785797

got it.
Thanks!

1 Like

that helped.
Thanks!

1 Like