Reworked layout of program

Made a function out of the integration steps so it can be called multiple
times for the user input checks that were also added. User input checks
are simple and only check the value of n (number of iterations).