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");
}
}
}
}