import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-- > 0) {
int n = scanner.nextInt();
int x = scanner.nextInt();
// Your code goes here
int z=n*x;
if(10000<=z<=99999)
{
System.out.println("yes");
}
else{
System.out.println("No");
}
}
}
}
@nasiya
its in the way you have written the condition .
I have corrected it in your code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-- > 0) {
int n = scanner.nextInt();
int x = scanner.nextInt();
// Your code goes here
int z=n*x;
if(z>=10000&&z<=99999)
{
System.out.println("yes");
}
else{
System.out.println("No");
}
}
}
}
Hello,
It looks like you’re trying to check whether the product of n and x falls within a specific range (between 10000 and 99999). However, the condition in your if statement is not correct. In Java, you should use the logical AND (&&) operator to check if a value is within a certain range.
Here’s the corrected version of your code:
import java.util.Scanner;
public class Main {
public static void main(String args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-- > 0) {
int n = scanner.nextInt();
int x = scanner.nextInt();
// Your code goes here
int z = n * x;
// Corrected condition
if (10000 <= z && z <= 99999) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
}
Now, the if statement correctly checks if the product z is between 10000 and 99999 using the logical AND operator.