All submissions for this problem are available.
Problem Definition :
CodeCell was known to set difficult problems last year due to which this year we start with an easy problem. Given an integer n, print the result after finding the sum of all even numbers until n and then subtracting all odd numbers(the sum of odd numbers) until n from the sum
- 1 <= t <= 100
- 0 <= n <= 109
- First line contains t, the number of testcases.
- The only line of each testcase contains a single integer n.
- For each testcase output a single integer as mentioned in the problem statement.
2 6 10
For the first test case, sum of all odd numbers till 6, i.e 1+3+5 = 9 and sum of all even numbers till 6, i.e 0+2+4+6 = 12, hence the answer is 12 - 9 = 3.
|Tags||cakewalk, kpr32018, math-formulas, shmabulock|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, PYP3|
Fetching successful submissions