When you type a number into the Serial Monitor, like 50, that number is sent, as a series of characters, to the Arduino ('5' and '0').
Your code reads the 1st character ('5'), on each pass through loop(), and treats it like it were the value entered in the serial monitor. The character has an ASCII collating sequence value associated with it ('0' = 48, '1' = 49, etc.). It is that value (an integer) that is used to calculate the position to move the servo to, which is, of course, not what you want.
zoomkat's code reads the whole collection of characters sent, assembles them in a string, extracts the character array from the string ('5', '0', NULL), and converts that NULL terminated character array to an integer (50), and that integer is used to calculate the position to move the servo to, which is closer to what you want.
The problem with zoomkat's code is that it expects you to send something other than a %-age. It expects you to send a value that drives a continuous rotation servo.
In your modification, you are now taking the %-age (an integer value between 0 and 100) and dividing it by 179 (another integer) resulting in 0, which you then multiply by 100, resulting in 0.
Do the multiplication first, then the division. Or, use the map function:
n = map(n, 0, 100, 0, 179);