SHARE
TWEET

Untitled

a guest Jun 26th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int i, n;
  8.     float sum = 0;
  9.  
  10.     cout << "Enter the value of n: ";
  11.     cin >> n;
  12.  
  13.     for (i=1; i<=n; i++)
  14.         sum += 1.0/pow(i,2);
  15.  
  16.     cout << "Sum: " << sum;
  17.  
  18.  
  19.     return 0;
  20. }
  21.      
  22. for (i=1; i<=n; i++)
  23.     sum += pow(2,-i);
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