Why it failing the test cases

#include
#define max 500
using namespace std;
int multiply_fact(int num, int *res, int res_size);
void factorial(int main_number)
{
int res[max];
res[0]=1;
int res_size=1;
for(int num=2; num<=main_number; num++)
{
res_size = multiply_fact(num,res,res_size);
}
cout<<“Factorial Of A Given Number Is”<<endl;
for(int i=res_size-1;i>=0;i–)
{
cout<<res[i];
}
}

int multiply_fact(int num, int *res, int res_size)
{
int carry=0;
for(int j=0;j<res_size; j++)
{
int product = res[j]*num + carry;
res[j]= product%10;
carry= product/10;
}
while(carry)
{
res[res_size]=carry%10;
carry = carry/10;
res_size++;
}
return res_size;
}
int main()
{
int N;
cin>>N;

factorial(N);
return 0;
}

Sample Input
5
Sample Output
120

Check if the sample output matches exactly with your code output. You do not need this line cout<<“Factorial Of A Given Number Is”<<endl;
If still your test cases does not pass…then please save your code on ide.codingblocks.com and share its link.

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.