Printing the Lower Part of the Axe

We need to divide the lower part of the figure into two subparts - head of the axe and the last row of the figure. We will print the head of the axe on the console by making a loop which recurs n / 2 - 1 times. At each iteration the left dashes and the right dashes decrease by 1, and the middle dashes increase by 2.

For the last row we can use the three declared and initialized varibles leftDashes, middleDashes, rightDashes again.

Testing in the Judge System

Test your solution here:

results matching ""

    No results matching ""