AshfaqFardin

Factorial

Jul 30th, 2021
769
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int N = 0;
  8.     cin >> N;
  9.    
  10.     int factorial = 1;
  11.     for(int i = N; i > 0; i--){
  12.         factorial *= i;
  13.     }
  14.    
  15.     cout << "Factorial of " << N << " is " << factorial;
  16.     return 0;
  17. }
  18.  
RAW Paste Data