Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- using namespace std;
- long double fact(int q)
- {if (q < 0)
- return 0;
- if (q == 0)
- return 1;
- else
- return q * fact(q - 1);}
- int main()
- { setlocale(0, "");
- int w, e, r, q, n;
- q, n, w = 0;
- e = 1;
- while (e == 1)
- { w++;
- cout << "введите число" << endl;
- cin >> q;
- cout << q << "! = " << fact(q) << endl;
- cout << "хотите продолжить 1 или 0" << endl;
- cin >> r;
- if (r == 0)
- {e = 0;}}
- cout << w << " совершенных вычислений" << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement