i cant find any way to obtain the code for this problem pls suggest some method hint or explain the approach to form the code for this problem i try my own just give some hint aur approach ki kaisen try karrein
FACTORIAL OF LARGE NUMBER LIKE 100!
Create an array ‘res[ ]’ of MAX size where MAX is number of maximum digits in output.
Initialize value stored in ‘res[ ]’ as 1 and initialize ‘res_size’ (size of ‘res[ ]’) as 1.
Do following for all numbers from x = 2 to n……
a) Multiply x with res[ ] and update res[ ] and res_size to store the multiplication result.
multiply(res[ ], x)
Initialize carry as 0.
Do following for i = 0 to res_size – 1 ……
a) Find value of res[i] * x + carry. Let this value be prod.
b) Update res[i] by storing last digit of prod in it.
c) Update carry by storing remaining digits in carrying.
Put all digits of carry in res[ ] and increase res_size by number of digits in carry
sir iss approach mein merko ye doubt hein humne res[max] array banadii manlete hein ki max=500 hein phir humne res[0] =1 thats ok tooo bakki cells prr too garbage value hoogi
aur hum same array ko multiply function mein bhi bhejege uska effect nhi hooga program prr
Hi, it will be by default 0 value…
https://ide.codingblocks.com/s/627075 refer line 12 there i have tried to show the same by printing some random indexes…
perr sir kaisen 0 hua humne tooo khalli res[0]=1 define kiya hein bakki tooo 0 kaisen when we define array like this arr[500]={0);then only it gives other indexes value 0
int n = 100;
int arr[n];
arr[0]=0;
cout<<arr[1]<<" "<<arr[2];
return 0;
output
PS G:\c++> .\random.exe
1878001568 1878003816
#define MAX 2000
ye likhne se vo default set hojata hai… i have made implemented in code u sent just now https://ide.codingblocks.com/s/627082
thank you sir now i am able to get the code tysm for the help
is there anything else or shall i mark it as resolved?
resolved sir mark it as resolved i am able to get the code now
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.