I wanted to put this as comment but due to reputation restriction i have to add it as an answer.
Though your code is fine, another thing to look is amount of division happening the code, Division is computationally expensive operation and as @Michael has suggested that it is redundant. So always try to minimise the multiplication and division operation in your code.
You have mentioned your self asthat you are a beginner programmer, i. I believe it is a good practice to start familiarising your self with topics like Computational Complexity.
Look here for computational complexity of mathematical functions