Advertisement
Korotkodul

classwork1

Sep 5th, 2024 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #include <algorithm>
  4. #include <vector>
  5.  
  6. int main()
  7. {
  8.     double pi = 3.1415926535;
  9.     double P = 1.0;
  10.     for (int i = 1; i <= 9000000; ++i) {
  11.         P *= (double)(((double)i * (double)i * 4.0) / (4.0 * (double)i * (double)i - 1.0));
  12.     }
  13.     cout << "\n";
  14.     cout << P << "\n";
  15.     cout << pi / 2.0 << "\n";
  16. }
  17.  
  18. /*
  19. $ /c/projects/B.exe line_approx.txt
  20. line_approx.txt  0.262479 0  0.873039 0
  21. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement