Doan logic 2

 avatar
unknown
plain_text
3 years ago
155 B
4
Indexable
def f(x):
    if x == 1:
        return 0
    return f(x-1) + x


t = int(input())
while t > 0:
    t -= 1
    x = int(input())
    print(f(x))
Editor is loading...