Question: public static int do_stuff(int x) { if(x

public static int do_stuff(int x) {

if(x<=0) {

return 1;

}

else {

return do_stuff(x-1)+do_stuff(x-2);

}

} What will the value of ans be after the method is called like this:

int ans=do_stuff(2);

Question 10 options:

1

2

3

4

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!