My issue
if(n<=m){
System.out.println("Chef needs “+ n + " shoes”);
}
else{
System.out.println("Chef needs "+ ((2*n)-m) + " shoes");
what is the mistake im doing here.
My code
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 n = read.nextInt();
int m = read.nextInt();
// Update your code below this line to solve the problem
if(n<=m){
System.out.println("Chef needs "+ n + " shoes");
}
else{
System.out.println("Chef needs "+ ((2*n)-m) + " shoes");
}
}
}
}
Learning course: Beginner DSA in Java
Problem Link: CodeChef: Practical coding for everyone