Perform calculation based on user input and display the result