Doan logic 2
unknown
plain_text
3 years ago
155 B
5
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...
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))