TheRasVa

Задача 6,1

May 15th, 2015
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6. unsigned long long rec_fact(unsigned long long a)
  7. {
  8.     if (a == 0)
  9.     {
  10.         return 1;
  11.     }
  12.     else
  13.     {
  14.         return a*rec_fact(a - 1);
  15.     }
  16. }
  17.  
  18.  
  19. int main()
  20. {
  21.     unsigned int a;
  22.     setlocale(LC_ALL, "russian");
  23.     system("color 0A");
  24.     cin >> a;
  25.     cout << rec_fact(a) << endl;
  26.     system("pause");
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment