My issue
import java.util.*;
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 c=read.nextInt();
int b=(a+c)/2;
if(b instanceof Integer){
System.out.println(b);
}
else{
System.out.println(-1);
}
}
}
}
My code
import java.util.*;
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 c=read.nextInt();
int b=(a+c)/2;
if(b instanceof Integer){
System.out.println(b);
}
else{
System.out.println(-1);
}
}
}
}
Learning course: Java for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone