Advertisement
Polnochniy

Untitled

Feb 10th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class Factorial
  4. {
  5. public:
  6. int N;
  7. int rez = 1;
  8. int factor(int N)
  9. {
  10. for (int i = 1; i <= N; i++)
  11. {
  12. rez = rez * i;
  13. }
  14. return rez;
  15. }
  16.  
  17. };
  18. int main()
  19. {
  20. int buf ;
  21. setlocale(LC_ALL, "Russian");
  22. cout << "Найти факториал числа " << endl;
  23. cout << " Введите число " << endl;
  24. cin >> buf;
  25. Factorial examp;
  26. examp.N = buf;
  27. cout << "Факториал равен " << examp.factor(buf);
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement