Advertisement
STANAANDREY

ex9

Jan 19th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. { // problema 9
  6.   unsigned n,e=0,i;
  7.   float x,S=0,p=1.0;
  8.   cout<<"x=";cin>>x;
  9.   cout<<"n=";cin>>n;
  10.   for (i=1;i<=n;i++)
  11.   {
  12.       p*=x;
  13.       e+=i;
  14.       S+=p/e;
  15.   }
  16.     cout<<"S="<<S;
  17.      return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement