Advertisement
add1ctus

Факториел

Sep 30th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int faktoriel(int a)
  6. {
  7.     if(a==1)
  8.         return 1;
  9.     else
  10.         return a*faktoriel(a-1);
  11. }
  12.  
  13. int main()
  14. {
  15.     int a;
  16.     cin>>a;
  17.     cout<<faktoriel(a);
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement