# Feedback for LBJ208C problem

Learning course: Beginner DSA in Java
Problem Link: CodeChef: Practical coding for everyone

### Feedback

I am not able to run my code, it’s throwing a Scanner Exception :

at java.base/java.util.Scanner.throwFor(Scanner.java:937)
at java.base/java.util.Scanner.next(Scanner.java:1594)
at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
at Codechef.main(Main.java:8)

@abdurrahman791

import java.util.*;
class Shoe_Pair
{
public static void main(String args)
{
Scanner sc = new Scanner(System.in);
int T, N, M, total, to_buy;
T = sc.nextInt();
for(int i=1; i<=T; i++)
{
N = sc.nextInt();
M = sc.nextInt();
if(M <= N)
{
total = 2 * N;
to_buy = ((total/2) - M) + (total/2);
}
else
{
System.out.println(N);
}
}
}
}

@abdurrahman791
In this problem u have to replace the _ like this
or else u will get some error.

``````// Solution as follows
import java.util.Scanner;

class Codechef
{
public static void main (String[] args)
{
int n = 10;
int m = 10;
if(n<=m){
System.out.println("We need to buy " + n +" shoes");
}
else{
System.out.println("We need to buy " + (2*n-m) +" shoes");
}

n = 15;
m = 10;
if(n<=m){
System.out.println("We need to buy " + n +" shoes");
}
else{
System.out.println("We need to buy " + (2*n-m) +" shoes");
}
}
}
``````

Oh ! such a silly mistake. Thanks brother.

1 Like