Read the following program segment and answer the question given below. Show dry run/working.
int fun(int a[], int n){
int x;
if(n == 1)
return a[0];
else
x = fun(a, n – 1);
if(x > a[n – 1])
return x;
else
return a[n – 1];
}
a) What will the output when function fun() is called with the value of a[] = {55, 87, 48, 24, 9} and n
= a.length?
b) What will the output when function fun() is called with the value of a[] = {-1, -2, 8, 7, 0, -1} and n
= a.length?
c) In one line state what function fun(...) is doing?
A GENUINE ANSWER IS REQUESTED, PLEASE DO NOT SPAM.
Answers
Answered by
0
c) In one line state what function
Similar questions