Practice pieces


Loops: rabbits

This practice piece is just about loops and maths.


Hints:

You just need one, main, class to do this job.

The algorithm is:

// Make a numberOfRabbits integer variable and set it = 2.
// Print out the number in this generation.
// Make a loop that runs from two up to and including 20. Note that we're not starting at zero.
// In the loop, do the relevant maths and print the number in the generation.

If you need more help, here's the answers (or one option, anyhow), and some additional tasks.