# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Hello Choto Bondhu!

By Shahwat_Has9 · Limits 1s, 512 MB

Let's play a game. I will give you a number $n$. You will have to tell me $n^2$. Okay, it may seem difficult for you to calculate this huge number. So tell me the last digit of $n^2$. In other words: $n^2 \mod 10$.

## Input

The first line will contain $T$ ($1 ≤ T ≤ 100$), which indicates test cases.

Next $T$ lines will each contain a number $n$ ($1 ≤ n ≤ 10^{100000}$).

## Output

For each cases, print $n^2 \mod 10$.

## Sample

InputOutput
6
1
2
3
4
5
6

1
4
9
6
5
6


When $n = 1$, $ans = (n * n) \mod 10 = 1 \mod 10 = 1$.

When $n = 2$, $ans = (n * n) \mod 10 = 4 \mod 10 = 4$.

When $n = 3$, $ans = (n * n) \mod 10 = 9 \mod 10 = 9$.

When $n = 4$, $ans = (n * n) \mod 10 = 16 \mod 10 = 6$.

When $n = 5$, $ans = (n * n) \mod 10 = 25 \mod 10 = 5$.

When $n = 6$, $ans = (n * n) \mod 10 = 36 \mod 10 = 6$. Math

### Statistics

63% Solution Ratio

DraakKrijgerFCEarliest, Mar '20

loserManFastest, 0.0s

ben2919Lightest, 0 B

touhidurrrShortest, 40B

### Submit

 AUST CSE 44th Batch Practise Contest 03 Mar '20 SCB-PA Inter School and College Programming Contest 2019 - School Division Mar '20 Practice Contest Before IUTCPC Dec '20 Kickoff Programming Contest of Spring 2022 4d ago National High School Programming Contest 2020 - Practice Contest Jun '20 Mirror of SCB-PA Inter School and College Programming Contest 2019 Mar '20 Long Practice Sessions on ISCPC 2019 Problems- 2 Apr '20 Sad Day To Die Hard Aug '20 SCB-PA Inter School and College Programming Contest 2019 - College Division Mar '20 