 Count numbers with unit digit K in given range
Submissions: 943   Accuracy: 13.9%   Difficulty: Easy   Marks: 2

Given a range from low to high and a number K. The task is to count the number which has the unit digit equal to K.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains three numbers low, high and K.

Output:
For each test case, print the count  of numbers in new line.

Constraints:
1<=T<=100
1<=low<=high<=109

0<=K<=9

Example:
Input:

2
4 9 4
3 35 3
Output:
1
4

Explanation:

Input  : low = 3, high = 35, K = 3
Output : 4
Numbers are  3, 13, 23, 33.

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

Author: arun03

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.