Courses‎ > ‎APCS - Term 1‎ > ‎Konstantinovich‎ > ‎

2019-01-29

posted Jan 29, 2019, 6:23 AM by Konstantinovich Samuel   [ updated Jan 30, 2019, 5:53 AM ]
DO NOW:

1. Take out notebook + Log in 
2. Fill out the information gathering form, then LOG OUT.


Homework:  (DO NOT work on this in class.)

Let us solve these recursively as a warmup: (on paper)

1. public static int factorial(int n){}
factorial(0) = 1
factorial(1) = 1
factorial(3) = 6


2. public static int sumZeroToN(int n){}
sumZeroToN(0) = 0
sumZeroToN(1) = 1
sumZeroToN(2) = 3

3. public static int sumAtoB(int a,int b){}
sumAtoB(1,2) = 3
sumAtoB(1,1) = 1
sumAtoB(4,6) = 15

Comments