Why my two test cases are failed

here is the code. import java.util.*;
public class Main
{
public static void main (String args[])
{
int i,j,m,n;
Scanner sc=new Scanner(System.in);
m=sc.nextInt();
if(m>=1&&m<=1000)
{
int a[]=new int[m];
for(i=0;i<m;i++)
a[i]=sc.nextInt();
n=sc.nextInt();
if(n>=1&&n<=1000)
{
int b[]=new int[n];
for(i=0;i<n;i++)
b[i]=sc.nextInt();
if(m<n)
{
int c[]=new int[n];
for(i=0;i<n-m;i++)
c[i]=b[i];
for(i=n-m,j=0;i<n;j++,i++)
c[i]=a[j]+b[i];
for(i=0;i<n;i++)
System.out.print(c[i]+","+" “);
}
else if(m>n)
{
int c[]=new int[m];
for(j=0;j<m-n;j++)
c[j]=a[j];
for(j=m-n,i=0;j<m;j++,i++)
c[j]=a[j]+b[i];
for(i=0;i<m;i++)
System.out.print(c[i]+”,"+" “);
}
else
{
int c[]=new int[m];
for(i=0;i<n;i++)
c[i]=a[i]+b[i];
for(i=0;i<n;i++)
System.out.print(c[i]+”,"+" ");

}
System.out.print("END");
		 }
	 }
}

}

please resolve my issue

Your logic is incorrect. You need to start adding the two arrays from their most right digit while you are doing it from the left most digit

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.