X158: bunnyEars2

We have bunnies standing in a line, numbered 1, 2, ... The odd bunnies (1, 3, 5, ...) have the normal 2 ears. The even bunnies (2, 4, ...) we'll say have 3 ears, because they each have a raised foot. Recursively return the total number of "ears" in the bunny line 1, 2, ... n (without using loops or multiplication).

Your Answer:


Practice a different Java exercise


Your feedback will appear here when you check your answer.