Sum of two array

hey my 2 test cases are running but two are not running out of 4 … i think my code is right and i also unlock the test cases but unable to open the test cases . whenever i open the test case my pc shows that this file does not open as you dont have particular app to open this file…so first of all tell me how to open you test case whenever we unlock and download …and then tell me what is error in my code as 2 test cases are not running

here is my code

#include
using namespace std;
int sum(int a[1000000],int b[1000000],int n,int m)
{
int i,j,k,q,w;
int c[1000000];
if(n>m)
{
k=n-m;
for(i=m-1+k;i>=k;i–)
{
b[i]=b[i-k];
}
for(i=0;i<k;i++)
{
b[i]=0;
}
m+=k;
}
if(m>n)
{
k=m-n;
for(i=n-1+k;i>=k;i–)
{
a[i]=a[i-k];
}
for(i=0;i<k;i++)
{
a[i]=0;
}
n+=k;
}
if(m==n)
{
w=0;
for(i=n-1;i>=0;i–)
{
if(i==0)
{
q=a[i]+b[i];
c[i]=q+w;
}
else
{
q=(a[i]+b[i])%10;
c[i]=q+w;

		}
		w=(a[i]+b[i])/10;

	}
	for(i=0;i<n;i++)
	{
		cout<<c[i]<<", ";
	}
}
cout<<"END";
return 0;

}
int main() {
int i,j,s,n,m;
int a[1000000],b[1000000];
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cin>>m;
for(i=0;i<m;i++)
{
cin>>b[i];
}
sum(a,b,n,m);
return 0;
}

for the test case:
1
9
1
9
ur o/p is
18, END
required
1,8,END

no …according to question add 2 arrays …so you are saying that both size of array is 1 and when we plus 9 and 9 its 18…so how can u say 1,8…

u need to generate a carry whenever the sum of the digit is greater than 9
this is what the question demands from u

eg
2
9 9
1
9
will not give u
9 , 18, END

it should be logically giving u
1,0,8,END
even even u add 2 arrays on paper this is what u will get and not 9,18,END

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.