Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int maxValue(int A[], int n)
- {
- if (n == 1)
- return A[0];
- return max(A[n-1], maxValue(A, n-1));
- }
- int main()
- {
- int A[] = {1, 4, 45, 6, -50, 10, 2};
- int n = sizeof(A)/sizeof(A[0]);
- cout << maxValue(A, n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement