 Timer is Running

Squares Difference
##### Submissions: 3461   Accuracy: 38.57%   Difficulty: Basic   Marks: 1

Given an integer n, find the absolute difference between sum of the squares of first n natural numbers and square of sum of first n natural numbers.

Input:

The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows, a single line of the input containing a positive integer N.
Output:

For each  testcase,  print the absolute difference between sum of the squares of first n natural numbers and square of sum of first n natural numbers.
Constraints:

1<=T<=100

1<=N<=1000
Example:

Input:

2

10

5

Output:

2640

170

Explanation: Testcase 2 : N = 5, Sum of 5 natural numbers from 1 to 5 = 15 i.e. 15 *15 = 225.
Sum of squares of numbers from 1 to 5 = 1 + 4 + 9+ 16+ 25 =  55.
So, absolute difference is (225 - 55) = 170.

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

Contributor: Sahil Chhabra
Author: Sahil_Chhabra

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.