How would you do it on a calculator?
Write down in order exactly what buttons to press.
Then you can determine an algorithm for the computer to follow, to do the same thing.