Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Factorial
- {
- private:
- int N;
- int rez;
- public:
- Factorial()
- {
- cin >> N;
- rez = 1;
- }
- int get_N()
- {
- return N;
- }
- int get_rez()
- {
- return rez;
- }
- int64_t factor(int N)
- {
- for (int i = 1; i <= N; i++)
- {
- rez = rez * i;
- }
- return rez;
- }
- };
- int main()
- {
- int buf1;
- setlocale(LC_ALL, "Russian");
- cout << "Найдите факториал числа " << endl;
- cout << " Введите число " << endl;
- Factorial examp;
- buf1 = examp.get_N();
- cout << "Факториал равен " << examp.factor(buf1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement