Where in the code have you declared the n variable?
You are getting the error with p because it is unreachable in the part of code you are requesting it. Try declaring it above the main method as...