Why this code is not working on rest of two cases

Source Code
#include<bits/stdc++.h>
using namespace std;
void reverseArray(int a[],int m)
{
int i=0,j=m-1;
while(i<j)
{
swap(a[i],a[j]);
i++;
j–;
}
}
int main()
{
int m;
cin>>m;
int a[m];
for(int i=0;i<m;i++)
{
cin>>a[i];
}
reverseArray(a,m);
int n;
cin>>n;
int b[n];
for(int i=0;i<n;i++)
{
cin>>b[i];
}
reverseArray(b,n);
int max=m,min=n;
if(m<n)

{
     max=n;
}
if(max==n)
{
      min=m;
}
int res[max]={0};
for(int i=0;i<min;i++)
{
	int temp;
	temp=a[i]+b[i];
	res[i]+=(temp)%10;
	temp=temp/10;
	if(temp>0)
	{
		res[i+1]+=temp;
	}
}
for(int j=min;j<=max;j++)
{
	if(m==max)
	{
	res[j]+=a[j];
    }
    else
    {
    	res[j]+=b[j];
	}
}
reverseArray(res,max);
for(int i=0;i<max;i++)
{
	cout<<res[i]<<", ";
}
cout<<" END"<<endl;

}

@the.shubham.sri
please share code through ide.codingblocks.com as code changes when pasted here and is difficult to work with

hey @the.shubham.sri when there is carry from adding last terms you need to print it for example in case of
1
9
1
9
answer would be 1, 8, END
but your answer is 8, END

https://ide.codingblocks.com/s/206820 Please tell me where i should make change so that it passes all the test case

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.