Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std ;
- int main() {
- int n;
- cin >> n;
- double S = 0.0;
- for(int i = 2; i <= 2 * n; i += 2) {
- S += ((double)(i - 1) / (double)(i * i));
- cout << i - 1 << "/" << i << " " << ((double)(i - 1) / (double)(i * i)) << endl;
- }
- cout << S << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement