daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. double sum_of_30_terms()
  2. {
  3.     int i, count=0;
  4.     double sum=0.0;
  5.  
  6.     for(i=1; count < 30; i *= 2)
  7.     {
  8.         count++;
  9.         sum += 1.0 / i;
  10.     }
  11.  
  12.     return sum;
  13. }
  14.  
  15. int main()
  16. {
  17.     cout << "Sum of 30 terms= " << sum_of_30_terms();
  18.     return 0;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top