/* 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
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
while(1<10)
{
int n=Integer.parseInt(br.readLine());
if(n!=42)
System.out.println(n);
else
System.exit(0);
}
}
}
ur code works
may be u are not giving any input in ide
try submitting ur code
https://www.codechef.com/viewsolution/26043660
Thank you. Should i use custom input?
It doesn’t have a submit button. Sorry if i sound totally lame but i’m very new to this.
1 Like
View solution window doesn’t have submit button
1 Like
that is ur code
and i submitted
u are just viewing ur code
u cannot submit there
go here and submit
choose java
paste ur code
click on submit
2 Likes
Here, it’s still showing NZEC
1 Like
u should give 42
otherwise
it will in be infinite loop
just click on submit without doing anything
and see magic
1 Like
ohhhhhh. It got submitted . Thank you a lot!
So basically every time i need to use custom input?
Thank you so much!
1 Like
You will find test cases in every question.
Just copy and paste the test case input in the custom input window.
And check if your code’s output matches the given test case output.
You have to write your code in such a way that it takes input in the same format as mentioned in the question.
In the screenshot you provided, I can see that you didn’t provide proper input in the custom input box. You have to type in the numbers (in this case <42) you want to input in the custom input box.
Hope this helps
4 Likes
Thanks a lot. it did work!
1 Like