Advertisement
Guest User

Untitled

a guest
Jul 31st, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.io.BufferedInputStream;
  2. import java.io.IOException;
  3. import java.io.PrintStream;
  4.  
  5. public class Main {
  6.     public static BufferedInputStream in = new BufferedInputStream(System.in);
  7.     public static void main(String[] args) throws IOException {
  8.         PrintStream out = new PrintStream(System.out);
  9.         int n;
  10.         while ((n = nextInt()) != 42)
  11.             out.println(n);
  12.         in.close();
  13.         out.close();
  14.     }
  15.    
  16.     public static int nextInt() throws IOException {
  17.         int number = 0;
  18.         int digit;
  19.         while ((digit = in.read()) != '\r' && digit != -1)
  20.             number = number*10 + digit - '0';
  21.         if (digit == '\r')
  22.             in.skip(1);
  23.         return number;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement