#### Solution

We should notice that the output of the program depends on a few things. First we have to check what is the entered gender and then check the age. Respectively, we are going to use a few if-else blocks. These blocks will be nested, meaning from the result of the first, we are going to define which one of the others to execute.

After reading the input data from the console, the following program logic should be executed: