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