Advertisement
AshfaqFardin

Factorial

Jul 30th, 2021
900
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  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.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement