How to perform multiple calculation based on user input