0
Hw does it execute?
2 Respuestas
+ 9
class sam{
public static int f(int x){
if(x==0)
return 2;
else
return 1+ f(x-1);
}
public static void main(String args[]){
System.out.println(f(3));
}
}
f(3)
= 1 + f(2)
= 1 + 1 + f(1)
= 1 + 1 + 1 + f(0)
= 1 + 1 + 1 + 2
= 5
0
tq frds