Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int fact(int num)
  5. {
  6. int result=1;
  7. while(num)
  8. {
  9. result*=num;
  10. num--;
  11. }
  12. return result;
  13. }
  14. int n;
  15. int main()
  16. {
  17. cin>>n;
  18. cout<<fact(n);
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement