Please enter your email address or userHandle.
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
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.