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