1 / 5
Jul 2008

Hi..
Im getting a Runtime Error NZEC:
And i dont understand y>>

import java.io.*;
import java.math.*;
public class Main {
    /**
 * @param args
 */
public static void main(String[] args) throws IOException
{
	String s=(new DataInputStream(System.in)).readLine();
	while(!s.equals(""))
	{
		if(s.equals("1"))
		{
			System.out.println("1");
			s=(new DataInputStream(System.in)).readLine();
			continue;
		}
		BigInteger q=new BigInteger(s);
		System.out.println(q.multiply(new BigInteger("2")).subtract(new BigInteger("2")));
		s=(new DataInputStream(System.in)).readLine();
	}
	}
	// TODO Auto-generated method stub

}

plss help

  • created

    Jul '08
  • last reply

    Aug '08
  • 4

    replies

  • 217

    views

  • 3

    users

11 days later

i am not a java user, so these are simply suggestions/observations. however, i got this in java.

can you directly print a BigInteger?

does your while loop work? i used a BufferReader's ready method as a conditional

11 days later

Oops...
My bad... i am printing it after using toString()

And i put a null as well.... and its still not working

You don't need to use toString, println automatically adds the toString for you, ignore what the last poster said smile

The only problem with this is dealing with end of file, so when you said 'you put a null', you must have done it wrong.

Suggested Topics

Want to read more? Browse other topics in JAVA based languages or view latest topics.