C++ Assistance

Hi, I'm very new to C++ and was wondering if someone could help me work out how to solve this.

Write a C++ program that calculates (with at least 10 significant digits)
1/(1 ×23) + 1/(22×33) + 1/(32×43) + ... + 1/(982×993) +1/(992×1003)
Your provided algorithm is probably not correct,

it should be IMO,
1/(1 ×23) + 1/(10 ×23) + 1/(22×33) + 1/(32×43) + ... + 1/(982×993) +1/(992×1003)

Well you have it, all you have to do is code it,
Create for loop and 3 variables called divisor,result,dividend.
const int divisor = 1;
inside for loop caculate result like so:
dividend = i * j;

result += divisor / dividend;

for loop would look like this:
1
2
3
4
for(int i = 1, j = 23; i <= 992; i += 10, j += 10)
{
    // algorithm calculation goes here
}



Now you have an basic idea, try to solve it on your own.
Last edited on
Thank you for the assist :) I'll give it a go!
Topic archived. No new replies allowed.