Broken Calculator

why is it not accepting the code while there’s no error during compilation
#include

using namespace std;

int main() {

int n;

cin>>n;

int fact;

fact=n;

while(n>1 && n<=500){

n–;

fact=fact*n;

}

cout<<fact;

return 0;

}

The value of factorial is very large and cannot be stored even in long long int you should use array to store such large value