Yes, @imthedarkclown . A better optimization for this will be
int getFactorial(int n, int num) {
if(n==0)
return num;
return getFactorial(n-1, n*num);
}
int main() {
int n, res;
scanf("%d", &n);
res = getFactorial(n,1);
printf("%d", res);
return 0;
}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yes, @imthedarkclown . A better optimization for this will be