Guest User

Untitled

a guest
May 24th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1.     float firstTerm = 4/1;
  2.     float sign = 1;
  3.  
  4.     for (float i = 3; i <= 100000000; i += 2)
  5.     {
  6.         //cout << setprecision(20) << i << endl;
  7.         sign *= -1;
  8.         firstTerm += sign *(4/i);
  9.     }
  10.  
  11.     cout << "pie to 20 significant figures:     ";
  12.     cout << setprecision(20) << firstTerm << endl;
  13.    
  14.    
  15.     //cout << setprecision(20) << 1.0 / 3.0;
  16.  
  17.  
  18.  
  19.     int i = 0;     
  20.     cin >> i;
  21.  
  22.    
  23.     return 0;
Add Comment
Please, Sign In to add comment