I'm having trouble trying to figure out how to put this into code. The main function of this is the user inputs the number of iterations he or she thinks it will take to get close to the sixth decimal point of Pi.
π = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11
First off I do this
#define Pi 3.1415926535
Then I know a few variables that I need which are
int Numerator, Denominator;
My question is how do you put in code that after every other fraction you want a minus and then a plus as shown up top? That's the only thing I need help with.
On a side note. I'm gonna be using a loop to ask if the user wants to do it again or try again until gets the right answer. Also, I know I'm gonna use Increments.
I appreciate any input/advice.