I’ve been preparing for competitive exam and I came across this question. I tried writing the code for it. But I didn’t got the answer according to the options given. The output I got was time out.
Please help me find the correct answer
What value would the following function return for the input x = 95?
Function fun (x:integer):integer;
Begin
If x > 100 then fun : x – 10
Else fun : fun(fun (x + 11))
End;
And the options are
(a) 89 (b) 90 (c) 91 (d) 92
I made this of it in JAVA:
the result was:
.