This is a very straight forward problem. For a given value of N your task is to find out the difference between the summation of all odd numbers and the summation of all even numbers. For example, if N is 7 then sum of all odds are (1+3+5+7) = 16 and sum of all even are (2+4+6) = 12. So the difference between the summation of all odd numbers and the summation of all even numbers is 4.
The input contains a number N (0 ≤ N ≤ 1018).
For each input N you should output the difference between the summation of all odd numbers and the summation of all even numbers.
Input | Output |
---|---|
1 | 1 |
Input | Output |
---|---|
7 | 4 |