Series sum according to the formula C++ [closed]

I need to write a program/function which calculates the series sum according to the formula:

series sum

The data that the user types is: m.

I am a total beginner and I have no idea how to do it… I am assuming that I need to create a loop (or 2)… but how…? So I would be very grateful if someone could help me.

Answer

The symbol Σ (sigma) is generally used to denote a sum of multiple terms. In that way you have to sum all (1+j) / (2*j**3 + 3) for every j from 0 to m.

As you see bellow, m is equal to 14, but you can change this parameter.

#include <iostream>
#include <math.h>

using namespace std;

int main() {
    float s = 0;
    int m = 14;
    for(int j = 0; j <= m; j++) s += (1 + j) / (pow(j, 3) + 3);
    cout << s;
    return 0;
}

And if you need to take a user input you are welcome as well

#include <iostream>
#include <math.h>

using namespace std;

int main() {
    float s = 0;
    int m;
    cin >> m;
    for(int j = 0; j <= m; j++) s += (1 + j) / (pow(j, 3) + 3);
    cout << s;
    return 0;
}

Using multiplication instead of pow function

#include <iostream>

using namespace std;

int main() {
    float s = 0;
    int m;
    cin >> m;
    for(int j = 0; j <= m; j++) s += (float)(1 + j) / (j*j*j + 3);
    cout << s;
    return 0;
}