diff --git a/algorithms/CPlusPlus/Maths/factorial.cpp b/algorithms/CPlusPlus/Maths/factorial.cpp index a97f98c1..34ab73d1 100644 --- a/algorithms/CPlusPlus/Maths/factorial.cpp +++ b/algorithms/CPlusPlus/Maths/factorial.cpp @@ -30,7 +30,7 @@ int main() { cin>>n; cout<<"factorial is: "<>m; + int factorial = 1; + int j = 1; + while (j <= m) { + factorial = factorial * j; + j++; + } + cout << "factorial of the given number is :" <