-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTen_from_Two.java
More file actions
32 lines (29 loc) · 796 Bytes
/
Copy pathTen_from_Two.java
File metadata and controls
32 lines (29 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.company;
import java.io.IOException;
import java.util.Scanner;
public class Ten_from_Two {
public static void main(String[] args) throws IOException {
//write your code here
int n,t,x = 0;
Scanner s = new Scanner(System.in);
t = s.nextInt();
while (t!=0) {
n = s.nextInt();
if (n % 5 == 0) {
if(n % 10 == 0){
System.out.println("0");
}
else{
do {
n = n * 2;
x++;
}while(n % 10 != 0);
System.out.println(x);
}
} else {
System.out.println("-1");
}
t--;
}
}
}