How will i know the output for negative input

my code is running fine for all positive numbers but how will i consider the negative input if i dont know the output to it will it give the same output with a negative sign for -7 as an input

n wont be negative ever