scientific_comp_projects/CODE/[python]kattis/trivial/last_factorial_digit.py
2021-10-29 15:16:40 +02:00

17 lines
265 B
Python

def factorial(n):
if n == 1:
return 1
if n>1:
return n*factorial(n-1)
n = int(input())
show = []
for i in range(n):
nb = int(input())
answer = factorial(nb)
show.append(str(answer)[-1])
for s in show:
print(s)