Given two numbers A and B. The task is to compute the last digit of the resulting F, where F= B! / A! .
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains two number A and B as input.
For each test case, print last digit of B! / A! (B factorial/ A factorial).
Input : A = 2, B = 4 Output : 2 Explanation : A! = 2 and B! = 24. F = 24/2 = 12 --> last digit = 2
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.