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.
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.
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.
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.
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.