Arrays sum of two arrays1

arrays-sum of two arrays what should be the approach behind the question.

Hi Aastha, in this question you just have to take the input of the two arrays and pass them to a function. In that function, you need to add the values of the two arrays like in the given example,
Arr1 = [1 0 2 9]
Arr2 = [3 4 5 6 7]
So, let num1 = 1029 and num2 = 34567
Perform normal addition on num1 and num2
1029+34567 = 35596
Return this new number to main and print in the given output format like 3, 5, 5, 9, 6, END.

https://ide.codingblocks.com/s/51164

i am getting wrong answer for this

Hey Aastha, your code is not handling the carry correctly that’s why you are getting wrong answer, for eg.
input:
3
5 5 5
3
5 5 5

your code’s output:
1, 1, 1, END

but the expected output is:
1, 1, 1, 0, END

1 Like