public class Main {
static int findPosSum(int A[], int N) { if (N <=>=> return 0; { if(A[N-1]>0) return (findPosSum(A, N - 1) + A[N - 1]); else return findPosSum(A, N - 1); }
} public static void main(String[] args) { int demo[] = { 11, -22, 33, -4, 25,12 }; System.out.println(findPosSum(demo, demo.length)); }}
Consider the recursive function you wrote in the previous problem.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here