Maximum sum difference
##### Submissions: 331   Accuracy: 31.13%   Difficulty: Easy   Marks: 2

Given a number N. We have to find maximum sum of all permutations of numbers from 1 to N. The maximum sum will be sum of absolute difference of adjacent elements in array.

Input:
First line contains an integer T denoting number of test cases. The next T lines contains a single integer N each.

Output:
For each test case, print the maximum sum.

Constraints:
1 <= T <= 100
1 <= N <= 1000

Example:
Input:
2
2
3
Output:
1
3

Explanation:
Input : 2
Output : 1

Permutations of 2 are:

{1, 2} = 1

{2, 1} = 1

```Input : 3
Output : 3
Permutations of size 3 are:
{1, 2, 3} = 1 + 1
{1, 3, 2} = 2 + 1
{2, 1, 3} = 1 + 2
{2, 3, 1} = 1 + 2
{3, 1, 2} = 2 + 1
{3, 2, 1} = 1 + 1

```

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: ShivamKD

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.