Broken calculator.. i dont know what is wrong with my code.. plz help me out

#include
#include
using namespace std;
int main(){
int n;
cin>>n;
int res[1000];
int resSize;
res[0]=1;
int carry=0;
int x=2;
while(x<=n){
for(int i=0;i<resSize;i++){

 	   int prod=res[i]*x + carry;
 	   res[i]=prod%10;
 	   carry=prod/10;
    }
    //check if there's carry left in the end
    while(carry){
     	res[resSize]=carry%10;
 		carry=carry/10;
 		resSize++;
	}
	x++;
 }
 //print in reverse order
 for(int i=resSize-1;i>=0;i--){
 	cout<<res[i];
 }

}

Hello @shikharskj please wait i am checking your code.

this is the updated code:


i have commented the error.
Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.