2 test are not working

I have compiled it with some more outputs also. but still 2 test arent working.

hello @mittali

check ur code output for ->
4
9 9 9 9
4
9 9 9 9

please check again this code

the output you gave. its working in this code

check now->

u should not access negative indices, as in some compiler it will give u segmentation fault.

cant I write the same code as before i>=0 an j>=0 and addition to it i will do after loop that if(sum){ a[s] = sum; s++}. i can add this.

no …

	while(i>=0 || j>=0){
		sum = sum+a[i]+a1[j];
		if(sum>=10){

here i or j can be negative as well after some iteration, so it is needed to put an if stetement for each indices and add to sum only if valid.

for example->
1
6
5
1 2 3 4 5
if u consider above case then just after one iteration ur i will be -1 but we still have elements of other array left to add in our answer.

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.