diff --git a/Algorithms/factorial_template/factorial/bin/Debug/factorial.exe b/Algorithms/factorial_template/factorial/bin/Debug/factorial.exe new file mode 100644 index 0000000..763d26d Binary files /dev/null and b/Algorithms/factorial_template/factorial/bin/Debug/factorial.exe differ diff --git a/Algorithms/factorial_template/factorial/factorial.cbp b/Algorithms/factorial_template/factorial/factorial.cbp new file mode 100644 index 0000000..3a66a1c --- /dev/null +++ b/Algorithms/factorial_template/factorial/factorial.cbp @@ -0,0 +1,43 @@ + + + + + + diff --git a/Algorithms/factorial_template/factorial/factorial.depend b/Algorithms/factorial_template/factorial/factorial.depend new file mode 100644 index 0000000..2790077 --- /dev/null +++ b/Algorithms/factorial_template/factorial/factorial.depend @@ -0,0 +1,4 @@ +# depslib dependency file v1.0 +1575527076 source:c:\users\kavya goyal\desktop\a2oj\factorial\main.cpp + + diff --git a/Algorithms/factorial_template/factorial/factorial.layout b/Algorithms/factorial_template/factorial/factorial.layout new file mode 100644 index 0000000..cb2d198 --- /dev/null +++ b/Algorithms/factorial_template/factorial/factorial.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Algorithms/factorial_template/factorial/main.cpp b/Algorithms/factorial_template/factorial/main.cpp new file mode 100644 index 0000000..725025c --- /dev/null +++ b/Algorithms/factorial_template/factorial/main.cpp @@ -0,0 +1,27 @@ +#include + +using namespace std; + +int main() +{ //FACTORIAL + //no of which factorial s to be found out, + int n; + cin>>n; + +// We can also do this without the array, using the for loop only also + int arr[n]; + long long int fac = 1; + + for(int i=1; i<=n; i++){ + fac= fac*(i); + arr[i-1] = fac; +} +if(n==0){ + arr[n-1] = 1; + } +//An array of all the numbers till then would be created. +//To access the factorial of the number +cout<