xxxxxxxxxx
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll fact(ll a){
ll ans = 1;
ll curr = 1;
while(a--){
ans *= curr;
curr++;
}
return ans;
}
int main(){
int x;
cin >> x;
cout << fact(x) ;
}
xxxxxxxxxx
#include<iostream>
using namespace std;
int factorial(int x){
if(x==0){ // Base-case ( VERY IMPORTANT)
return(1);
}
else{
return(x*(factorial(x-1))) ;
}
}
int main(){
int no = 5;
cout << factorial(no) ; // 120
}