# Feedback for BMJC08 problem

Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone

### Feedback

for this sum

why is this code not accepted even though the logic and code gives right answers?
import java.util.Scanner;

class Codechef {
public static void main(String args) {
Scanner read = new Scanner(System.in);

int t = read.nextInt();
for (int i = 0; i < t; i++) {
int a = read.nextInt();
int b = read.nextInt();

// Update your code below this line to solve the problem
while (a < b) {
if (a % 2 == 0) {
a = a + 2;
} else {
a = a + 1;
}
}

if (a != b) {
System.out.println("NO");
} else {
System.out.println("YES");
}
}
}

}

may be your code is failing for some edge test cases.
plzz refer the following solution for better understanding

// Solution as follows
import java.util.Scanner;
class Codechef
{
public static void main (String[] args)
{
Scanner read = new Scanner(System.in);

int t = read.nextInt();
for(int i=0; i<t; i++)
{
int a = read.nextInt();
int b = read.nextInt();

int diff = b-a;

if((b-a)%3 == 0){
System.out.println("YES");
}
else if((b-a)%3 == 1){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}