Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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);
- }
Add Comment
Please, Sign In to add comment