4 Replies - 341 Views - Last Post: 07 February 2018 - 06:17 PM Rate Topic: -----

#1 soul0h   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 07-February 18

Find the sum of numeric series of: ...........

Posted 07 February 2018 - 11:16 AM

Hey guys , so i have this homework for tomorrow to find the sum of numeric series of: "1/(2*3) + 4/(5*6) + 7/(8*9)............3*n-2 / (3n-1)*(3*n)"
I did this but im not sure if i have it done right or not , if its wrong please me another way of fixing it.
p.s dont get it too complicated im a begginer thanks

[sub]#include <iostream>
using namespace std;
int main(){
double i,n,sum=0,k=2,l=3,h=1;
cout<<"Give the number n: \n";
cin>>n;
for (i=1;i<=(3*n-2)/(3*n-1)*(3*n);i++)
{
sum+=h/(k*i);
h=h+3;
k=k+3;
l=l+3;
}
cout<<"The sum of the numeric series is: "<<sum;
return 0;
}[/sub]


Is This A Good Question/Topic? 0
  • +

Replies To: Find the sum of numeric series of: ...........

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14045
  • View blog
  • Posts: 56,201
  • Joined: 12-June 08

Re: Find the sum of numeric series of: ...........

Posted 07 February 2018 - 11:39 AM

What happens when you run it? Does it match up what you have when you do it by hand?
Was This Post Helpful? 0
  • +
  • -

#3 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1460
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Find the sum of numeric series of: ...........

Posted 07 February 2018 - 12:54 PM

I'm afraid its not correct...

You are over complicating things the solution is actually much simpler than you have,
unfortunately this is a homework assignment so the help you will get from me will be sparing..

you have an equation which you have to sum for all "n" terms, actually think of what that means...

the general form of the equation is (3*n-2)/(3*n-1)*(3*n) for all n terms...

actually think how you could easily sum the equation for all n terms up.....
Was This Post Helpful? 1
  • +
  • -

#4 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3786
  • View blog
  • Posts: 13,715
  • Joined: 08-August 08

Re: Find the sum of numeric series of: ...........

Posted 07 February 2018 - 04:15 PM

If you were to use descriptive variable names you'd likely see the problems.
Was This Post Helpful? 0
  • +
  • -

#5 tony jay   User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 50
  • Joined: 31-January 18

Re: Find the sum of numeric series of: ...........

Posted 07 February 2018 - 06:17 PM

snoopy11 has given you the essential key - solve the maths before you attempt the coding.
You need to generalise the equation - once you have done that, coding the thing will be relatively trivial.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1