Given 6 numbers a,b,c,d,e,f. Find the last digit of (ab)*(cd)*(ef).
Input: a = 3 b = 66 c = 6 d = 41 e = 7 f = 53 Output: 8 Explanation: The last digit of the value obtained after solving the above equation is 8.
Input: a = 1 b = 1 c = 1 d = 1 e = 1 f = 1 Output: 1 Explanation: The last digit of the value obtained after solving the above equation is 1.
You don't need to read input or print anything. Your task is to complete the function theLastDigit() which takes 6 integers a, b, c, d, e, and f and returns the last digit of the value obtained from the equation.
Expected Time Complexity: O(sqrt(N))
Expected Auxiliary Space: O(1)
1 <= a,b,c,d,e,f <= 109
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.