Question: Write a method called recAdd that will add the (integer) elements of an array. For example if the array were {4,8,10} the method would return

Write a method called recAdd that will add the (integer) elements of an array. For example if the array were {4,8,10} the method would return 22. Note the method will need to take as parameter the array and also the index of the last element. IN JAVA

public class Lab { public static void main (String []args) { int A[] = { 3,4,16,8,-9,10}; System.out.println(recAdd(A, 5)); }

public static int recAdd(int A[], int n) //n is the index of the last element { } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!