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
Get step-by-step solutions from verified subject matter experts
