How do I make a form to calculate 2 or more variables

I want to make a simple form where users enter 2 or more numbers (in different input text) and when they hit on calculate button the result is displayed as a text. In my understanding, you have to store the input in 2 variables as numbers and then put the formula to calculate those 2 variables and display the result. Can someone advise how to do this please?