import mathcase = int(input()) for i in range(case): n = int(input()) print(math.factorial(n)%10)
2 1 10
1 0
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!