Quick Exponents
Submissions: 523   Accuracy:

21.6%

  Difficulty: Easy   Marks: 2

Given two numbers a and b. Find the last digit of a raised to the power b.

Input:
First line of input contains an Integer T, which denotes the number of test cases. Each line of the test case contains two integer a and b.

Output:

Print the last digit of a raised to the power b.
 

Constraints:
1<=T<=10^5
1<=a,b<=10^18


Example:
Input:
2
3 4
2 8
Output:
1
6

** For More Input/Output Examples Use 'Expected Output' option **

Author: ShivamKD


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.