I am always getting NoSuchElement Exception on Codeshef IDE, but my code is running successfully on other online & offline IDE. Please help me, I am not able to submit my codes

//Please check & reply as soon as possible
import java.util.;
import java.lang.
import java.io.*;
class Coins
public static void main(String args[])throws IOException
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
int n,c1,c2,c3,sp=0;

brother it is getting because your are not giving input .
In Codechef Run button means it will first compile & then Run.

1 Like

your code compile successfully but when it runs it don’t find any input.

1 Like

Thank you, it’s working now :slight_smile:

What modification u did in ur code to solve this exception @nikhil510

he wasn’t taking input at the right places i think…enter a statement to take input
like for python

a = int(input())

for C++

//I am newbie in C++
int t
cin >> t

something like this…dunno for java tho

As suggested by @codedirector, I just wasn’t taking input while running.