pls let me know what will be the approach.
i wrote a code using long long but it will not give write ans.
pls let me know what will be the approach.
i wrote a code using long long but it will not give write ans.
@deepak147852 hey,The following is detailed algorithm for finding factorial.
factorial(n)
How to multiply a number ‘x’ with the number stored in res[]?
The idea is to use simple school mathematics. We one by one multiply x with every digit of res[]. The important point to note here is digits are multiplied from rightmost digit to leftmost digit. If we store digits in same order in res[], then it becomes difficult to update res[] without extra space. That is why res[] is maintained in reverse way, i.e., digits from right to left are stored.
multiply(res[], x)