How would you make a loop to solve the following summation: sqrt (3) / (1 x 2) + sqrt (4) / (2 x 3) + sqrt (5) / (3 x 4) + ... + sqrt (99) / (97 x 98) + sqrt (100) / (98 x 99).
Here is what I can get:
double sum, x, y, z;
x = 3;
y = 1;
z = 2;
sum = 0;
while (x <= 100)
{
sum = sqrt (x) / (y * z);
x++;
y++;
z++;
}
cout << "The summation = " << sum << endl;
I am stumped on how to complete this loop to get the right answer. =(
Here is what I can get:
double sum, x, y, z;
x = 3;
y = 1;
z = 2;
sum = 0;
while (x <= 100)
{
sum = sqrt (x) / (y * z);
x++;
y++;
z++;
}
cout << "The summation = " << sum << endl;
I am stumped on how to complete this loop to get the right answer. =(
Any help would be greatly appreciated!
int x;
for(x=3; x<=100; x++) {
sum+= sqrt(x)/((x-2)(x-1));
}
Thank you so much!!!! Lol, I couldn't figure out what was going wrong haha! =)