Here is the question - TEST Problem - CodeChef
Here is the code
import java.util.Scanner;class y{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
while(in.nextInt() != 42){}return;}
}
Here is the question - TEST Problem - CodeChef
Here is the code
import java.util.Scanner;class y{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
while(in.nextInt() != 42){}return;}
}
You donot seem to be outputting anything , while loop should be something like this
while(1>0)
{
n= sc.nextInt();
if(n!=42)
System.out.println( “” + n ) ;
else
break;
}
You do not seem to be outputting anything
In your code
while(in.nextInt() != 42){
/* output the number from input here
followed by a new line*/
}