Skip to content

Commit

Permalink
Merge pull request #1 from ProfessorParadox/patch-2
Browse files Browse the repository at this point in the history
Update and rename factorials.cpp to factorialrecursion.cpp
  • Loading branch information
sajjalt committed Oct 3, 2018
2 parents b009527 + 6b90a2d commit 1553660
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
20 changes: 20 additions & 0 deletions factorial/factorialrecursion.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <iostream>
using namespace std;

int factorial(int n)
{
if (n <= 1)
return 1;

else
return n * factorial(n - 1);
}

void main()
{
int i;
cout << "Enter a natural number:\n\n";
cin >> i;
cout << i << "!\t=\t" << factorial(i) << endl;

}
19 changes: 0 additions & 19 deletions factorial/factorials.cpp

This file was deleted.

0 comments on commit 1553660

Please sign in to comment.