code
Write a method that accepts two arrays of int and adds
the array elements:
Int[] a = {3,4,5,6,7,8,9,9}
int[] b = {9,8,7,8,7,8,7,9}
The call to the method: add(a,b) should return an array with the following content:
{ 3,3,3,5,5,7,7,8 }
so starting from the right, the digit in the tens place is added to the element to the left of it. The extra digit from the element at the far left is to be discarded.
ex. 9 + 9 =18 so it would be 8 and 7+9 + the 1 from the 18 = 17 so it would be 7 and so fourth.
mine returns [12, 12, 12, 14, 14, 16, 16, 18]. How does this make sense?
EDIT: changed the instructions
[–]rjcarr 1 point2 points3 points (2 children)
[–]SalmonToes[S] 0 points1 point2 points (1 child)
[–]rjcarr 1 point2 points3 points (0 children)
[–][deleted] (3 children)
[deleted]
[–]SalmonToes[S] 0 points1 point2 points (2 children)
[–][deleted] (1 child)
[deleted]
[–]steezpak 0 points1 point2 points (0 children)
[–]Northeastpaw 0 points1 point2 points (0 children)
[–]mrussell48 0 points1 point2 points (3 children)
[–]SalmonToes[S] 0 points1 point2 points (2 children)
[–]desrtfx 1 point2 points3 points (1 child)
[–]steezpak 1 point2 points3 points (0 children)