 Count number of digits after decimal
Submissions: 423   Accuracy: 17.53%   Difficulty: Basic   Marks: 1

Given two positive numbers A and B. The task is to divide A by B and calculate the number of digits after decimal.

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 two numbers A and B.

Output:
For each test case print the count of digits after decimal. If in case the numbers are irrational or the  decimals are non terminating print "-1".

Constraints:
1<=T<=500
1<=A,B<=106

Example:
Input:

2
4 5
1 3
Output:
1
-1

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

Contributor: Arun Tyagi
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.