themlgyo

Untitled

Nov 9th, 2017
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #include "uravn.h"
  2. #include <iostream>
  3. #include <clocale>
  4. using namespace std;
  5. int main()
  6. {
  7.     setlocale(LC_ALL, "RUSSIAN");
  8.     int m, n;
  9.     cout << "Введите n: ";
  10.     cin >> n;
  11.     cout << endl;
  12.     cout << "Введите m: ";
  13.     cin >> m;
  14.     cout << endl;
  15.     cout << "Решение: " << ((faktorial(n) + faktorial(m + 2)) / (faktorial(m) + 5)) << endl;
  16.     return 0;
  17. }
  18.  
  19. ##################
  20.  
  21. #include "uravn.h"
  22. #include "cmath"
  23. #include <iostream>
  24. #include <clocale>
  25.  
  26. double faktorial(int numb)// заголовок функции
  27. {
  28.     int rezult = 1; // инициализируем переменную rezult значением 1
  29.     for (int i = 1; i <= numb; i++) // цикл вычисления значения n!
  30.         rezult *= i; // накапливаем произведение в переменной rezult
  31.     return rezult; // передаём значение факториала в главную функцию
  32. }
  33.  
  34. ######################
  35.  
  36. double faktorial(int numb);
Add Comment
Please, Sign In to add comment