# C++ Program To Find Sum Of The Given Series 1/2+4/5+7/8+ . . . N

Problem :- Write A C++ Program To Find Sum Of The Given Series 1/2+4/5+7/8+.......N

Logic :- As we can see the the dividend of the given series is increase by 3 each time and divisor is also increasing by 3 but divisor =
dividend+1 so according to the series we can use for loop
Logic is Given Below .

for(i=0;i<n;++i)
{
x=a/(a+1);
sum+=x;
a+=3;
}

Try Yourself C++ Program To Find Sum Of The Given Series 1+2+3+4+5+6 . . . . n

Solution :-

#include<iostream>
using namespace std;
int main()
{
int i,n;
float sum=0,x,a=1;

cout<<"\n1/2+4/5+7/8+……'\n";
cout<<"\nEnter The Number of Terms \n";
cin>>n;

for(i=0;i<n;++i)
{
x=a/(a+1);
sum+=x;
a+=3;
}

cout<<"\n Sum = "<<sum<<endl;
return 0;
}

Output:-

Previous Post
Next Post

#### post written by: Ghanendra Yadav

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.