Special Series Sum
Submissions: 1596   Accuracy:

60.56%

  Difficulty: Basic   Marks: 1

Given the value of n, we need to find the sum of the series where i-th term is sum of first i natural numbers.

Note:- Sum of the series 1 + (1+2) + (1+2+3) + (1+2+3+4) + …… + (1+2+3+4+…+n)

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:

Print the sum of the series of N terms for each testcase.
Constraints:

1<=T<=100

1<=N<=1000
Example:

Input:

2

5

10

Output:

35

220

Explanation:

Testcase 1:

(1) + (1+2) + (1+2+3) + (1+2+3+4) + (1+2+3+4+5) = 35

Testcase 2:

(1) + (1+2) + (1+2+3) +  .... +(1+2+3+4+.....+10) = 220

 

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



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.