C++ Program – Sum of series using “for” loop
by Nideesh C on May 2, 2011 · 0 comments
in C++
//Downloaded From theonlinetutorials.com
//(C)2011.All rights reserved.
//SUM OF SERIES 1-x/1! + x3/2!....
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int f=1,h,j,k=1,i,n,x;
float s=0;
cout<<"Enter the numerator and limit"<<endl;
cin>>x>>n;
for(i=1;i<((2*n)-1);i=i+2)
{
f=1;
for(j=1;j<=(i+1)/2;j++)
{
f=f*j;
}
s=(s+((pow(x,i) * pow(-1,k))/f));
k++;
}
cout<<"Result "<<s+1;
getch();
}
Not Satisfied ? Just search & get the result
Related posts:
- C++ Program – Square of Nos
- C Program To find the sum of the cos series
- C++ program – No of Digits in a number (Using while loop)
- C++ Program – Sum of Prime nos
- C++ Program – Sum of Odd Even nos
Tagged as:
C++ Program - Sum of series using "for" loop,
CPP Program - Sum of series using "for" loop,
Sum of series using "for" loop in C++,
Sum of series using "for" loop in CPP
Me, freelance system administrator having the qualification of Diploma in Electronics & Tele-communication + MCSE + CCNA + CST + 5 years of experience in IT field.
If you like This post, you can follow TheOnlineTutorials on Twitter.
Contact me Via email: support@theonlinetutorials.com
Subscribe to feed via Feed or EMAIL to receive instant updates.
Legal Disclaimer:All information found on the site is without any implied warranty of fitness for any purpose or use whatsoever. Content author/site administrator is not responsible for any loss occurred due to mistakes in this tutorial. Use this tutorial website at your own risk.