Avengers Age of Ultron

3.2

20 votes
Problem

A meeting between SHIELD and Avengers took place to stop Ultron. All the Avengers are present in the meeting. Everyone is shaking hands with others but exactly once.

Tony Stark asked from Captain America that total how many handshakes took place in the meeting. Help Captain to calculate total handshakes.

INPUT:

The first line contains the number of test cases T, The next T lines follows.

Each line then contains an integer N, the total number of members attend the meeting.

OUTPUT:

Print the number of handshakes for each test-case.

Constraints:

1 <= T <= 1000

1 <= N <= 1000000

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?