fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main(String[] args){
  11. System.out.println(depth(5,0));
  12.  
  13. }
  14.  
  15. public static int depth(int n, int depth){
  16. System.out.println(depth);
  17. if(n == 0)return depth;
  18. else{
  19. System.out.println(depth);
  20. return depth(n-1, ++depth);
  21. }
  22. }
  23. }
Success #stdin #stdout 0.09s 37712KB
stdin
Standard input is empty
stdout
0
0
1
1
2
2
3
3
4
4
5
5