long val = /*start value for val*/ ;

for(int i = 1; i <= /*upper limit*/; /*increment*/)
{
val += //mathematical expression for the series
}