You can use a while loop, where the condition is the user input. i.e., loop while user input is not equal to 'q' or whatever the user is supposed to enter to quite the calculations.