/* NAME ___________________________ Section ____ * * Miniquiz10.java CSE143 8/6/2003 * What is the value returned by "recursor" for each of the following cases? * * 1. recursor(2, 10) * 2. recursor(5, 5) * 3. recursor(4, 3) * 4. recursor(0, -1) [Not graded] * * If you finish early... turn your paper over and list any "service and * participation" activities you believe you should have received credit for * (but haven't yet). */ public class Miniquiz10 { public static int recursor(int A, int B) { if (A < B) { return A; } int C = recursor(A-B, B+1); return A + B + C; } public static void testRecursor(int A, int B) { System.out.println("A=" + A + " B=" + B + " result=" + recursor(A, B)); } /** * @param args the command line arguments */ public static void main(String[] args) { testRecursor(2, 10); testRecursor(5, 5); testRecursor(4, 3); testRecursor(0, -1); } }