Allow program to run until stopped by the user and add function to calculate the average of an array