Created
January 20, 2019 08:14
-
-
Save rahman541/03f2d751543bf8ab86bd6438c5a675c0 to your computer and use it in GitHub Desktop.
Factorial finder in C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int factorialFinder(int x) { | |
if (x == 1) return 1; | |
return x * factorialFinder(x-1); | |
} | |
int main() { | |
cout << factorialFinder(5) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment