Test cases failed in Compute F(n)

For a positive integer ‘n’ let’s define a function:
f(n) = - 1 + 2 - 3 + … + (( - 1)n)*n
Your task is to calculate f(n) for a given integer n.

https://ide.codingblocks.com/s/436017 why all the test cases are failed