-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathequal_no1.java
51 lines (50 loc) · 1.32 KB
/
equal_no1.java
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.util.Scanner;
public class equal_no1
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("test cases : ");
int t = sc.nextInt();
for(int i = 0;i < t;i++)
{
System.out.println("enter a: ");
int a = sc.nextInt();
System.out.println("enter b: ");
int b = sc.nextInt();
if(a == b)
{
System.out.println("YES");
}
else if(a > b)
{
while (true)
{
if(a == b*2) {
System.out.println("YES");
break;
}
else if(a < b*2){
System.out.println("NO");
break;
}
b = b*2;
}
}
else if(a < b)
{
while (true)
{
if(a*2 == b) {
System.out.println("YES");
break;
}
else if(a*2 > b){
System.out.println("NO");
break;
}
a = a*2;
}
}
}
}
}