0

Explain pls the output of this code

public static void main(String[] args){ System.out.println(f(3)); } public static int f(int x){ if(x==0){ return 2; }else{ return 1+f(x-1); } } The output is 5.

30th Apr 2018, 8:37 PM
Ä°skender GĆ¼neş
Ä°skender GĆ¼neş - avatar
3 Answers
30th Apr 2018, 8:50 PM
cyk
cyk - avatar
+ 1
cyk thankyou. that was useful šŸ˜Š
1st May 2018, 1:27 PM
Ä°skender GĆ¼neş
Ä°skender GĆ¼neş - avatar
1st May 2018, 1:27 PM
Ä°skender GĆ¼neş
Ä°skender GĆ¼neş - avatar