Skip to content

Instantly share code, notes, and snippets.

@uysalserkan
Last active January 19, 2019 22:03
Show Gist options
  • Save uysalserkan/a8f93d377d8b761ef72661b1a869387d to your computer and use it in GitHub Desktop.
Save uysalserkan/a8f93d377d8b761ef72661b1a869387d to your computer and use it in GitHub Desktop.
This program give the factorial of numbers.
#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