BROKEN CALCULATOR

CAN YOU PLEASE HELP ME FOR BUILDING THE SOLUTION OF THIS PROBLEM??
HOW TO FIND FACTORIAL OF LARGE NUMBERS?

Factorial of 100 has 158 digits. It is not possible to store these many digits even if we use long long int.
use an array to store individual digits of the result

factorial(n)

Create an array result[] of MAX size where MAX is number of maximum digits in output.
Initialize value stored in result[] as 1 and initialize ‘size’ (size of result[]) as 1.
Do following for all numbers from x = 2 to n.
……a) Multiply x with result[] and update result[] and size to store the multiplication result
How to multiply a number ‘x’ with the number stored in result[]?

multiply(result[], x)

Initialize carry as 0.
Do following for i = 0 to size – 1
….a) Find value of result[i] * x + carry. Let this value be prod.
….b) Update result[i] by storing last digit of prod in it.
….c) Update carry by storing remaining digits in carry.
Put all digits of carry in result[] and increase res_size by number of digits in carry.

you can take help from this code only if needed

i hope this helps
try to implement
if you have any doubt or not understand any point in this appraoach
feel free to ask

for reference you can use this code

Reference Code

bhaiya, iske alawa koi aur approach bhi ho sakti hai?

in c++ you have to use array because you can’t store a no with 158 digits in any other premitive data type

you can use python to solve this

ok ji, thank you so much.