Advertisement
Nexon

Untitled

Dec 9th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. void main() {
  8.     double a = 1.0;
  9.     double s = 0.0;
  10.     double eps = 0.0001;
  11.  
  12.     setlocale(LC_ALL, "Russian");
  13.  
  14.     for(double i=1.0;eps<fabs(a);i++){
  15.         a = (pow(-1.0, i) + 5*i)/pow(i, i);
  16.         s+=a;
  17.     }
  18.  
  19.     cout<<"Сумма равна: "<<s<<endl;
  20.  
  21.     system("PAUSE");
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement