• + 0 comments

    Hi Etayluz,

    Thank you for your comment. May I ask a little about your solution ?

    My solution is almost exactly the same, excep that in this while loop while (carry) { len++; int dig = carry % 10; arr[len - 1] = dig; carry /= 10; }

                I did not have the step dig = carry % 10, and my answer was correct up to 15 !, but after that it was wrong. It worked for numbers even as big as 25 ! when I added the line dig  = carry % 10.
    
                I really don't understand why because I wrote my program in C++ and even store everything in unsigned long, which gives me the maximum of bits I can think of..But yours seem to be written in C and you stored everything in int ? When I tried to store my variables in int, it did not give the correct answer.
    
                I would really appreciate if someone knows the answer why there is such a difference in result !
                Thank you