Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- long double pi(int n) {
- long double sum = 0.0;
- int sign = 1;
- for (int i = 0; i < n; ++i) {
- sum += sign / (2.0*i + 1.0);
- sign *= -1;
- }
- return 4.0*sum;
- }
- int main()
- {
- long double n=1, a=0;
- while (true) {
- cout <<setprecision(1000)<< pi(n)<<endl;
- n++;
- a++;
- /*
- if (a == 5000) {
- system("pause");
- a = 0;
- }*/
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement