Doubt in line 15


Why did we add p in the ebd of line 15?

    p=(a[i]*n)+p;
	a[i]=p%10;
	p=p/10;

first you multiply the arr[i] with no for calculating factorial then you also add carray ( p ) to it
whole ans you get stored in p again
now you can place only one digit at ith index so take mod with 10
rest of no will goes in carrray ( p );

take a small example like 4 and then dry run the code
you will understand

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning:
if you have more doubts regarding this feel free to ask