Amazon interview question

write algorithm for a calculator