fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. /* Name of the class has to be "Main" only if the class is public. */
  4. class Ideone
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. int n = 10;
  9. System.out.println(fib(10));
  10. }
  11.  
  12. private static int fib(int n){
  13. if(n==0) return 0;
  14.  
  15. return n+fib(n-1);
  16. }
  17. }
Success #stdin #stdout 0.07s 54540KB
stdin
Standard input is empty
stdout
55