Can anyone help me with the code for thr above problem.I am not able to pass testcases.
#include
#include
using namespace std;
int main() {
int N,M,i;
cin>>N;
int a[1000]={0},n1=0,n2=0;
for(i=N-1;i>=0;iβ){
cin>>a[i];
}
cin>>M;
int b[1000]={0};
for(i=M-1;i>=0;iβ){
cin>>b[i];
}
int z=max(N,M);
int c[1000]={0};
for(i=0;i<=z;i++){
c[i]+=a[i]+b[i];
if((c[i]>9) ||(c[i]<-9)){
c[i+1]+=c[i]/10;
if(c[i]>9){
c[i]=c[i]%10;
}
if(c[i]<-9){
c[i]=c[i]%10-10;
}
}
}
if(c[z]==0){
for(i=z-1;i>=0;i--){
cout<<c[i]<<",";
}
}
else{
for(i=z;i>=0;i--){
cout<<c[i]<<",";
}
}
cout<<βENDβ<<endl;
return 0;
}