RadioNurshat

MultiFactorial

Sep 30th, 2020
879
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n;
  7.     int nn = 1;
  8.     int i = 0;
  9.     cin >> n;
  10.     if (n % 2 == 0) {
  11.          i = 2;
  12.     }
  13.     else {
  14.         i = 1;
  15.     }
  16.     while (nn < n) {
  17.         nn = nn * i;
  18.         i += 2;
  19.     }
  20.     cout << nn << endl;
  21. }
  22.  
  23.  
RAW Paste Data