Number of Diagonals
Submissions: 1886   Accuracy:

61.71%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given a number N. Write a program to the find number of diagonals possible in N sided convex polygon.

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

Output:
For each testcase in new line, print number of diagonals possible in N sided convex polygon.

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

Example:
Input:

2
5
6

Output:
5
9

Exaplanation:
Testcase 1:
The number of diagonals of 5 sided polygon: 5.

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