diff --git a/C++/LargeNumberFactorial.cpp b/C++/LargeNumberFactorial.cpp new file mode 100644 index 0000000..2cdc992 --- /dev/null +++ b/C++/LargeNumberFactorial.cpp @@ -0,0 +1,64 @@ +#include +using namespace std; +int main() +{ + int num; + cin>>num; + int arr[100000] = {0}; //array to store digits of factorial + + arr[0] = 1; //initializing 0th element as 1 because it is going to store unit digit + + int remainingNum = 0; //variable to store carry or other/remaining digit after storing unit digit in array at 0th position after multiplying it with number + + int lengthOfFactorial = 1; + + int number = 2; //factorial will start by 2 onwards and from 3,4,5,6......to N + + int position = 0; //variable to store position of digits which are to be stored in array + + while(number<=num){ + + position = 0; + remainingNum = 0; + while(position=0) + { + cout<