Whats the problem with this code

#include
using namespace std;
int main() {
int i,n,f=1;
cin>>n;
for(i=1;i<=n;i++)
{
f=i*f;
}
cout<<f;
return 0;
}

hey @garganshul151, no problem at all it is giving factorial of a number.

but all testcases are getting wrong

hey @garganshul151, if you are doing it for factorial of large number than this will not work as int datatype has some limit upto 32000.

correction kya karni h vo btaona

hey @garganshul151, you need to use array, which is different approach. Please refer to following links