fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main(String[] args) {
  11. // 50 digits of precision.
  12. MathContext mc = new MathContext(500);
  13.  
  14. for (int i = 2; i <= 1000; i++) {
  15. BigDecimal divisor = new BigDecimal(i);
  16. BigDecimal result = ONE.divide(divisor, mc);
  17. result.round(mc);
  18. System.out.println("%d/%d = %s\n", 1, i,
  19. result.toString());
  20. }
  21. }
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:11: error: cannot find symbol
  BigDecimal ONE = BigDecimal.ONE;
  ^
  symbol:   class BigDecimal
  location: class Ideone
Main.java:11: error: cannot find symbol
  BigDecimal ONE = BigDecimal.ONE;
                   ^
  symbol:   variable BigDecimal
  location: class Ideone
Main.java:13: error: cannot find symbol
  MathContext mc = new MathContext(500);
  ^
  symbol:   class MathContext
  location: class Ideone
Main.java:13: error: cannot find symbol
  MathContext mc = new MathContext(500);
                       ^
  symbol:   class MathContext
  location: class Ideone
Main.java:16: error: cannot find symbol
    BigDecimal divisor = new BigDecimal(i);
    ^
  symbol:   class BigDecimal
  location: class Ideone
Main.java:16: error: cannot find symbol
    BigDecimal divisor = new BigDecimal(i);
                             ^
  symbol:   class BigDecimal
  location: class Ideone
Main.java:17: error: cannot find symbol
    BigDecimal result = ONE.divide(divisor, mc);
    ^
  symbol:   class BigDecimal
  location: class Ideone
7 errors
stdout

Standard output is empty