I checked your answer,
seems correct to me, but I'm no genius in this field of expertise.
I also googled it to be sure and the problem has been used a million times only with different numbers.
Here's an example; https://answers.yahoo.com/question/index?qid=20110309151602AAcBisG
This also agrees with your method of operation, so it should be correct