Sir pls tell whats wrong in this code

sir pls tell whats wrong in this code… two test cases are not passing

when a carry is generate at the end then
no the final carry is not added to the answer
eg;
1
9
1
9

ur answer
8,END
but required answer
1,8,END

#include #include using namespace std; int main (){ int n; cin>>n; int arr3[1000]; int arr1[1000]; for(int i=0;i<n;i++){ cin>>arr1[i]; } int m; cin>>m; int arr2[1000]; for(int i=0;i<m;i++){ cin>>arr2[i]; } int max_no = max(n,m); // printing arrays // for(int i=0;i<n;i++){ // cout<<arr1[i]<<" “; // } // cout<<endl; // // for(int j=0;j<m;j++){ // cout<<arr2[j]<<” “; // } // cout<<endl; //shifting both the arrays towards right if(n!=max_no){ for(int i=max_no-1;i>=0;i–){ arr1[i]=arr1[i-1]; } } if(max_no!=m){ for(int i=max_no-1;i>=0;i–){ arr2[i]=arr2[i-1]; } } // printing updated arrays after shifting towards right // for(int i=0;i<max_no;i++){ // cout<<arr1[i]<<” “; // } // cout<<endl; // // for(int i=0;i<max_no;i++){ // cout<<arr2[i]<<” “; // } // cout<<endl; // int carry = 0; for(int i=max_no-1;i>=0;i–){ int sum = arr1[i] + arr2[i] + carry; if(sum>9){ sum=sum-10; arr3[i]=sum; carry = 1; } else{ arr3[i] = sum; carry = 0; } if(i==0 and sum>9){ arr3[i]=sum-10; max_no=max_no+1; for(int j=max_no-1;j>=0;j–){ arr3[j]=arr3[j-1]; } arr3[0]=1; } } for(int i=0;i<max_no;i++){ cout<<arr3[i]<<”,"<<" "; } cout<<“END”<<endl; return 0; }

still not working properly… can u share the corrected code

either please share ur code in CBE ide

or refer to the below code

maam i dont know how to share code in IDE… pls make changes in my code which i have sent and send it to me


open this
paste ur formated code
and click on the save button
there will be a change in url
send me that url