[quote="touches"]
import java.io.*;
class Test1
{
public static void main(String[] args) throws java.io.IOException
{
int m;
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println(" Input :");
do{
m= Integer.parseInt(bf.readLine());
}while(m!=42);
}
}
Well i followed your advice and changed the code. When i submit it i get the result as wrong answer even though it stops taking integers if we hit 42.. Please what could be wrong here any help[/quote]
As far as I knew, the public class name must be exactly "Main"....
you should not print even a single character other than the problem statement says,
and try like this:
keep reading 1 integer from input:
if it is 42 then terminate
else print it
hope this helps