Guest User

Untitled

a guest
Jan 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int fact(int);
  4. int main(){
  5. cout << "Please enter a positive integer: ";
  6. int user,final;
  7. cin >> user;
  8. cout <<"Your factorial of number is: "<<fact(user)<<endl;
  9. }
  10.  
  11. int fact(int num){
  12. if(num==1)
  13. return 1;
  14. return num*fact(num-1);
  15. }
Add Comment
Please, Sign In to add comment