Sum of two arrays? how to do

Take as input N, the size of array. Take N more inputs and store that in an array. Take as input M, the size of second array and take M more inputs and store that in second array. Write a function that returns the sum of two arrays. Print the value returned.

Input Format
Constraints
Length of Array should be between 1 and 1000.

Output Format
Sample Input
4
1 0 2 9
5
3 4 5 6 7
Sample Output
3, 5, 5, 9, 6, END
Explanation
Sum of [1, 0, 2, 9] and [3, 4, 5, 6, 7] is [3, 5, 5, 9, 6] and the first digit represents carry over , if any (0 here ) .

u can simply iterate from the right most digit of both the array
just add the no at the corresponding position in the array and carry

do not simple put in the value in the answer calculate
c = sum/10
val = sum%10

its similar to the normal addition we learnt at school

vec.push_back((c + sum%10)%10);

why two times mod 10 ???

because sum might be itself more than 9
so take mod 10

but u can optimise it by taking just 1 mod
(c+sum)%10 should work fine

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.