AP Computer Science - Recursion Worksheet 3 DIRECTIONS :


Transcribed Image Text:

AP Computer Science - Recursion Worksheet 3 DIRECTIONS : Fill in each blank with the correct answer/output. Assume each statement happens in order and that one statement may affect the next statement. Some sections might print more than once. public static int fun (int x) it (x<1) return 1) else return x+fun (x-1) +fun (x-2): public static int go (int x) it(xcl) return 1; else return x+go (x-2) +go (x-3) : public static int fly(int x) it(xcl) return li else return x+fly (x-4) fly (x-1): //runner code in the main of another class System.out.printin ("1- " fun (2)): Systen.out.printin ("42 - "+tun (6)) systen.out.printin ("3- "+go (5)1: syaten.out.printin(" "go (3)) Systen.out.printin("5"tly(4)) Systen.out.printin("46 Cly(5)) dessed as pouuapun buy M nor t cases, yo ep oug sest ys ou the origina some cas pstion abr Jo che

Members

  • Access to 2 Million+ Textbook solutions
  • Ask any question from 24/7 available
    Tutors
$9.99
VIEW SOLUTION

OR

Non-Members

Get help from Accounting Tutors
Ask questions directly from Qualified Online Accounting Tutors.
Best for online homework assistance.