Your task is to write a main program which asks the user for an error value and then calls a function CalculatePi (error) which returns an approximate value of π.
The function CalculatePi should use a loop to calculate the above series (*). It should keep two values, currentApproximation and nextApproximation. Initially currentApproximation = 4. The loop should keep adding and subtracting terms until the difference between currentApproximation and nextApproximation is less than error. It should then return currentApproximation.