Array-Sum of two arrays

We have to take a single digit or any random number in array?

u have to input 2 arrays by the user like 1 2 3 and 4 2 1 then add them output= 5 4 4

I am asking input should be single digit or it can be like
20 10 5
10 5 7
output is : 3162

single digit like
2 0 1 0 5 are are different one at a time

1 Like

Please check this code. Test case1 is showing wrong answer
https://ide.codingblocks.com/s/67065

ur code will not work for test cases where extra carry is generated even if all the digits of both array are iterated and lenght of both array are different
like case
1
9
2
9 9
output 1 0 8
ur output
1 2 8
handle this case
otherwise ur code is right…

if any problem reply i will modify ur code
:slight_smile:

I updated it. But it’s still showing wrong answer in test case1
https://ide.codingblocks.com/s/67065

Actually ur are using the wrong logic if one of the array finishese then u r using its negative index if 1 array finish then u have to handle the other array seperately
check this
https://ide.codingblocks.com/s/70704

this code is gving runtime error…now what to do??