you want to keep asking the user about height if n is smaller than 1 or larger than 8 right ? check your code, the way you're writing it ,the program is gonna keep asking for height as long as n is smaller than nine ! ( which is not what you want).
therefore the solution is change "while (n < 9)" to "while (n < 1 || n > 8)"
Your do-while loop has condition n < 9. Which means that it is continuously going to prompt the user for height until a value greater than 9 is not inputted. So to get desired results, your condition should be (n < 9 && n > 0).
Your next mistake is in the for loop. You have written an unnecessary semicolon between the for and the opening curly brace.