Last active
January 19, 2019 22:03
-
-
Save uysalserkan/a8f93d377d8b761ef72661b1a869387d to your computer and use it in GitHub Desktop.
This program give the factorial of numbers.
This file contains hidden or 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 fact(int); | |
int main(){ | |
cout << "Please enter a positive integer: "; | |
int user,final; | |
cin >> user; | |
cout <<"Your factorial of number is: "<<fact(user)<<endl; | |
} | |
int fact(int num){ | |
if(num==1) | |
return 1; | |
return num*fact(num-1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment