Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. using namespace std;
  4. long double fact(int q)
  5. {if (q < 0)
  6. return 0;
  7. if (q == 0)
  8. return 1;
  9. else
  10. return q * fact(q - 1);}
  11. int main()
  12. { setlocale(0, "");
  13. int w, e, r, q, n;
  14. q, n, w = 0;
  15. e = 1;
  16. while (e == 1)
  17. { w++;
  18. cout << "введите число" << endl;
  19. cin >> q;
  20. cout << q << "! = " << fact(q) << endl;
  21. cout << "хотите продолжить 1 или 0" << endl;
  22. cin >> r;
  23. if (r == 0)
  24. {e = 0;}}
  25. cout << w << " совершенных вычислений" << endl;
  26. system("pause");
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement