Hey guys! I'm trying to learn java myself and found just java exercise website called "Practice It!" and I'm stuck on this exercise and was wondering if someone can give me the code so I can study it and learn why it is the answer.
Here is the exercise:
Write a method named hopscotch that accepts an integer parameter for a number of "hops" and prints a hopscotch board of that many hops. A "hop" is defined as the split into two numbers and then back together again into one. 0 hops is a board up to 1; one hop is a board up to 4; two hops is a board up to 7; and so on.
For example, hopscotch(3); should print:
Thanks guys!
Here is the exercise:
Write a method named hopscotch that accepts an integer parameter for a number of "hops" and prints a hopscotch board of that many hops. A "hop" is defined as the split into two numbers and then back together again into one. 0 hops is a board up to 1; one hop is a board up to 4; two hops is a board up to 7; and so on.
For example, hopscotch(3); should print:
- Code:
1
2 3
4
5 6
7
8 9
10
Thanks guys!