My issue
Exception in thread “main” java.util.NoSuchElementException
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:18)
how to solve it!
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
int test=sc.nextInt();
while(test>0)
{
int a,b,c;
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
int avg_ab=(a+b)/2;
int avg_ac=(a+c)/2;
int avg_bc=(b+c)/2;
if(avg_bc<35 || avg_ac<35 || avg_ab<35)
System.out.println("Fail");
else
System.out.println("Pass");
}
}
}
Learning course: Introduction to Java
Problem Link: CodeChef: Practical coding for everyone