Added Validations to User Input and Loop conditions