#K93547. Sum of Product IDs
Sum of Product IDs
Sum of Product IDs
You are given a positive integer n and your task is to compute the sum of Product IDs from 1 to n. In other words, compute the value:
\(S = 1 + 2 + 3 + \cdots + n = \frac{n(n+1)}{2}\)
This is a classic arithmetic series problem that can be solved using the above formula. Your program should be able to process multiple test cases provided via standard input and output the corresponding result for each test case on a separate line.
inputFormat
The first line of input contains an integer T
representing the number of test cases. Each of the following T
lines contains a single integer n
for which you need to compute the sum of the first n positive integers.
outputFormat
For each test case, output a single line containing the sum, computed using the formula \(\frac{n(n+1)}{2}\).
## sample1
5
15
</p>