(-1)^k = 1 if k is even, -1 if k is odd so:
for (i=1; i<=N; i++)
{
if (i%2==0)//if it is even
{
sum+=1.0/(i+1);//since i is your k, you just divide by i+1
}
else
{
sum-=1.0/(i+1);
}
}
The rest is simply multiplying, then taking the square root.