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
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
Java returns null when it reaches the end of file, not an empty string.
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
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.