Sum Terms Nth Row
Submissions: 1245   Accuracy:

61.06%

  Difficulty: Basic   Marks: 1

Given a series as shown below:

               1  2
            3  4  5  6
        7  8  9 10 11 12
 13 14 15 16 17 18 19 20
    ..........................
    ............................
             (so on)

You are given a number N, you need to write a program to find the sum of all elements in the N-th row of above series.

Input:
First line of input contains a single integer T which denotes the number of test cases. First line of each test case contains a single intger N.

Output:
For each test case, print the sum of all the elements present in Nth row of above series.

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

Example:
Input:
2
2
4
Output:
18
132

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

Contributor: Harsh Agarwal
Author: harsh.agarwal0


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.