#include <iostream> #include <cmath> using namespace std; int main() { double to
ID: 3797339 • Letter: #
Question
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double total =0;
int entry;
cout << "Please input your n value for pi approximation " << endl;
cin >>entry;
for (int i=0; i <entry; i++)
total +=(pow(-1,i))/(2*i+1);
total *= 4;// you have only calulated thesequence inside the brackets. hav$
cout << "This approximation leads to an answer of " << total;
cout << " ";
return (0);
}
How do i make this program ask the user if they want to repeat it or close the program. Please fix the code.
Explanation / Answer
Hi, I modified the code . Now, it will be user friendly to continue again or terminate it
Code:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.